[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YRKLKGtxVZAbKVG5@codewreck.org>
Date: Tue, 10 Aug 2021 23:20:24 +0900
From: asmadeus@...ewreck.org
To: Leon Romanovsky <leon@...nel.org>
Cc: Tuo Li <islituo@...il.com>, ericvh@...il.com, lucho@...kov.net,
davem@...emloft.net, kuba@...nel.org,
v9fs-developer@...ts.sourceforge.net, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, baijiaju1990@...il.com,
TOTE Robot <oslab@...nghua.edu.cn>
Subject: Re: [PATCH] net: 9p: Fix possible null-pointer dereference in
p9_cm_event_handler()
Leon Romanovsky wrote on Tue, Aug 10, 2021 at 04:55:42PM +0300:
> On Tue, Aug 10, 2021 at 06:20:07AM -0700, Tuo Li wrote:
> > The variable rdma is checked when event->event is equal to
> > RDMA_CM_EVENT_DISCONNECTED:
> > if (rdma)
> >
> > This indicates that it can be NULL. If so, a null-pointer dereference will
> > occur when calling complete():
> > complete(&rdma->cm_done);
> >
> > To fix this possible null-pointer dereference, calling complete() only
> > when rdma is not NULL.
>
> You need to explain how is it possible and blindly set if () checks.
> I would say first "if (rdma)" is not needed, but don't know for sure.
Sounds like static analysis because there's a if (rdma) check in
RDMA_CM_EVENT_DISCONNECTED above, so if that needed check then it will
bug right afterwards
I'd tend to agree I don't think it's possible client->trans is null
there (it's filled right after rdma_create_id which defines the handler,
there might be a window where the callback is called before? But as I
understand it shouldn't be called until we resolve address and connect
then later disconnect)
So, I agree with Leon - unless you have a backtrace of a real bug
let's remove the other 'if' if you want to cleanup something for your
robot.
--
Dominique
Powered by blists - more mailing lists