From: lyl2019@mail.ustc.edu.cn
To: "Leon Romanovsky" <leon@kernel.org>
Cc: sagi@grimberg.me, dledford@redhat.com, jgg@ziepe.ca,
linux-rdma@vger.kernel.org, target-devel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: Re: [PATCH] infiniband: Fix a use after free in isert_connect_request
Date: Mon, 22 Mar 2021 22:51:35 +0800 (GMT+08:00) [thread overview]
Message-ID: <1af3e912.b6e4.1785a6b7802.Coremail.lyl2019@mail.ustc.edu.cn> (raw)
In-Reply-To: <YFipRTHpr8Xqho4V@unreal>
> -----原始邮件-----
> 发件人: "Leon Romanovsky" <leon@kernel.org>
> 发送时间: 2021-03-22 22:27:17 (星期一)
> 收件人: "Lv Yunlong" <lyl2019@mail.ustc.edu.cn>
> 抄送: sagi@grimberg.me, dledford@redhat.com, jgg@ziepe.ca, linux-rdma@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org
> 主题: Re: [PATCH] infiniband: Fix a use after free in isert_connect_request
>
> On Mon, Mar 22, 2021 at 06:53:55AM -0700, Lv Yunlong wrote:
> > The device is got by isert_device_get() with refcount is 1,
> > and is assigned to isert_conn by isert_conn->device = device.
> > When isert_create_qp() failed, device will be freed with
> > isert_device_put().
> >
> > Later, the device is used in isert_free_login_buf(isert_conn)
> > by the isert_conn->device->ib_device statement. My patch
> > exchanges the callees order to free the device late.
> >
> > Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
> > ---
> > drivers/infiniband/ulp/isert/ib_isert.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
>
> The fix needs to be change of isert_free_login_buf() from
> isert_free_login_buf(isert_conn) to be isert_free_login_buf(isert_conn, cma_id->device)
>
> Thanks
>
> >
> > diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
> > index 7305ed8976c2..d8a533e346b0 100644
> > --- a/drivers/infiniband/ulp/isert/ib_isert.c
> > +++ b/drivers/infiniband/ulp/isert/ib_isert.c
> > @@ -473,10 +473,10 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
> >
> > out_destroy_qp:
> > isert_destroy_qp(isert_conn);
> > -out_conn_dev:
> > - isert_device_put(device);
> > out_rsp_dma_map:
> > isert_free_login_buf(isert_conn);
> > +out_conn_dev:
> > + isert_device_put(device);
> > out:
> > kfree(isert_conn);
> > rdma_reject(cma_id, NULL, 0, IB_CM_REJ_CONSUMER_DEFINED);
> > --
> > 2.25.1
> >
> >
I see that function isert_free_login_buf(struct isert_conn *isert_conn) has only
a parameter, do you mean i need change the implementation of isert_free_login_buf?
I'm sorry to say that i am unfamilar with this module and afraid of making more mistakes,
because this function is being called elsewhere as well.
Could you help me to fix this issue? Or just fix it and tell me your commit number?
next prev parent reply other threads:[~2021-03-22 14:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-22 13:53 Lv Yunlong
2021-03-22 14:27 ` Leon Romanovsky
2021-03-22 14:51 ` lyl2019 [this message]
2021-03-22 15:31 ` Leon Romanovsky
2021-03-22 15:50 ` lyl2019
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1af3e912.b6e4.1785a6b7802.Coremail.lyl2019@mail.ustc.edu.cn \
--to=lyl2019@mail.ustc.edu.cn \
--cc=dledford@redhat.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sagi@grimberg.me \
--cc=target-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®