From: "Saleem, Shiraz" <shiraz.saleem@intel.com>
To: Jason Gunthorpe <jgg@nvidia.com>, Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Cc: "Latif, Faisal" <faisal.latif@intel.com>,
"dledford@redhat.com" <dledford@redhat.com>,
"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] infiniband/i40iw: Fix a use after free in i40iw_cm_event_handler
Date: Fri, 12 Mar 2021 01:13:39 +0000 [thread overview]
Message-ID: <1fc386d78c044d3da723fe38446edb75@intel.com> (raw)
In-Reply-To: <20210311182114.GA2733907@nvidia.com>
> Subject: Re: [PATCH] infiniband/i40iw: Fix a use after free in
> i40iw_cm_event_handler
>
> On Wed, Mar 10, 2021 at 07:14:14PM -0800, Lv Yunlong wrote:
> > In the case of I40IW_CM_EVENT_ABORTED, i40iw_event_connect_error()
> > could be called to free the event->cm_node. However, event->cm_node
> > will be used after and cause use after free. It needs to add flags to
> > inform that event->cm_node has been freed.
> >
> > Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
> > ---
> > drivers/infiniband/hw/i40iw/i40iw_cm.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
>
> This might be OK (though I don't like the free variable), Shiraz??
>
How was this reproduced? Do you have some call trace leading up to use after free?
The cm_node refcnt is bumped at creation time and once in i40iw_receive_ilq before packet is processed.
That should protect the cm_node from disappearing in the event handler in the abort event case.
The dec at end of i40iw_receive ilq should be point where the cm_node is freed specifically in the abort case.
Shiraz
next prev parent reply other threads:[~2021-03-12 1:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-11 3:14 [PATCH] infiniband/i40iw: Fix a use after free in i40iw_cm_event_handler Lv Yunlong
2021-03-11 18:21 ` Jason Gunthorpe
2021-03-12 1:13 ` Saleem, Shiraz [this message]
2021-03-12 1:57 ` lyl2019
2021-03-13 1:11 ` Saleem, Shiraz
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=1fc386d78c044d3da723fe38446edb75@intel.com \
--to=shiraz.saleem@intel.com \
--cc=dledford@redhat.com \
--cc=faisal.latif@intel.com \
--cc=jgg@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=lyl2019@mail.ustc.edu.cn \
/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