[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <eba3dbe9bf734dc0b65b2e65aa8d5bd9@intel.com>
Date: Sat, 13 Mar 2021 01:11:42 +0000
From: "Saleem, Shiraz" <shiraz.saleem@...el.com>
To: "lyl2019@...l.ustc.edu.cn" <lyl2019@...l.ustc.edu.cn>
CC: Jason Gunthorpe <jgg@...dia.com>,
"Latif, Faisal" <faisal.latif@...el.com>,
"dledford@...hat.com" <dledford@...hat.com>,
"linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: RE: [PATCH] infiniband/i40iw: Fix a use after free in
i40iw_cm_event_handler
> Subject: Re: RE: [PATCH] infiniband/i40iw: Fix a use after free in
> i40iw_cm_event_handler
>
>
>
>
> > -----原始邮件-----
> > 发件人: "Saleem, Shiraz" <shiraz.saleem@...el.com>
> > 发送时间: 2021-03-12 09:13:39 (星期五)
> > 收件人: "Jason Gunthorpe" <jgg@...dia.com>, "Lv Yunlong"
> > <lyl2019@...l.ustc.edu.cn>
> > 抄送: "Latif, Faisal" <faisal.latif@...el.com>, "dledford@...hat.com"
> > <dledford@...hat.com>, "linux-rdma@...r.kernel.org"
> > <linux-rdma@...r.kernel.org>, "linux-kernel@...r.kernel.org"
> > <linux-kernel@...r.kernel.org>
> > 主题: RE: [PATCH] infiniband/i40iw: Fix a use after free in
> > i40iw_cm_event_handler
> >
> > > 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@...l.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
> >
>
> This problem was reported by a path-sensitive analyzer developed by our Security
> Lab(Loccs).
> The analyzer reported that there is a feasible path to free event->cm_node and use
> it after, and that is what i described in the first commit.
>
OK. I don’t think that an extra dec refcnt in itself for the abort case is enough evidence to
say that the cm_node is freed in i40iw_event_connect_error.
Shiraz
Powered by blists - more mailing lists