[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YzQmr8LVTmUj9+zB@unreal>
Date: Wed, 28 Sep 2022 13:49:19 +0300
From: Leon Romanovsky <leon@...nel.org>
To: asmadeus@...ewreck.org
Cc: syzbot <syzbot+67d13108d855f451cafc@...kaller.appspotmail.com>,
davem@...emloft.net, edumazet@...gle.com, ericvh@...il.com,
kuba@...nel.org, linux-kernel@...r.kernel.org,
linux_oss@...debyte.com, lucho@...kov.net, netdev@...r.kernel.org,
pabeni@...hat.com, syzkaller-bugs@...glegroups.com,
v9fs-developer@...ts.sourceforge.net
Subject: Re: [syzbot] KASAN: use-after-free Read in rdma_close
On Wed, Sep 28, 2022 at 07:43:38PM +0900, asmadeus@...ewreck.org wrote:
> Leon Romanovsky wrote on Wed, Sep 28, 2022 at 01:07:23PM +0300:
> > The bug is in commit 3ff51294a055 ("9p: p9_client_create: use p9_client_destroy on failure").
>
> Thanks for looking
>
> > It is wrong to call to p9_client_destroy() if clnt->trans_mod->create fails.
>
> hmm that's a bit broad :)
>
> But I agree I did get that wrong: trans_mod->close() wasn't called if
> create failed.
> We do want the idr_for_each_entry() that is in p9_client_destroy so
> rather than revert the commit (fix a bug, create a new one..) I'd rather
> split it out in an internal function that takes a 'bool close' or
> something to not duplicate the rest.
> (Bit of a nitpick, sure)
Please do proper unwind without extra variable.
Proper unwind means that you will call to symmetrical functions in
destroy as you used in create:
alloc -> free
create -> close
e.t.c
When you use some global function like you did, there is huge chance
to see unwind bugs.
>
> I'll send a patch and credit you in Reported-by unless you don't want
> to.
>
> --
> Dominique
Powered by blists - more mailing lists