public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Pavel Skripkin <paskripkin@gmail.com>
Cc: syzbot <syzbot+aab53008a5adf26abe91@syzkaller.appspotmail.com>,
	dledford@redhat.com, jgg@ziepe.ca, linux-kernel@vger.kernel.org,
	linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
	syzkaller-bugs@googlegroups.com, zyjzyj2000@gmail.com
Subject: Re: [syzbot] KASAN: use-after-free Read in rxe_queue_cleanup
Date: Sun, 21 Nov 2021 16:15:57 +0200	[thread overview]
Message-ID: <YZpUnR05mK6taHs9@unreal> (raw)
In-Reply-To: <91426976-b784-e480-6e3a-52da5d1268cc@gmail.com>

On Sat, Nov 20, 2021 at 06:02:02PM +0300, Pavel Skripkin wrote:
> On 11/19/21 12:27, syzbot wrote:
> > Hello,
> > 
> > syzbot found the following issue on:
> > 
> > HEAD commit:    8d0112ac6fd0 Merge tag 'net-5.16-rc2' of git://git.kernel...
> > git tree:       net
> > console output: https://syzkaller.appspot.com/x/log.txt?x=14e3eeaab00000
> > kernel config:  https://syzkaller.appspot.com/x/.config?x=6d3b8fd1977c1e73
> > dashboard link: https://syzkaller.appspot.com/bug?extid=aab53008a5adf26abe91
> > compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> > 
> > Unfortunately, I don't have any reproducer for this issue yet.
> > 
> > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > Reported-by: syzbot+aab53008a5adf26abe91@syzkaller.appspotmail.com
> > 
> > Free swap  = 0kB
> > Total swap = 0kB
> > 2097051 pages RAM
> > 0 pages HighMem/MovableOnly
> > 384517 pages reserved
> > 0 pages cma reserved
> > ==================================================================
> > BUG: KASAN: use-after-free in rxe_queue_cleanup+0xf4/0x100 drivers/infiniband/sw/rxe/rxe_queue.c:193
> > Read of size 8 at addr ffff88814a6b6e90 by task syz-executor.3/9534
> > 
> 
> On error handling path in rxe_qp_from_init() qp->sq.queue is freed and then
> rxe_create_qp() will drop last reference to this object. qp clean up
> function will try to free this queue one time and it causes UAF bug.
> 
> Just for thoughts.

You are right, can you please submit patch?

Thanks

> 
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c
> b/drivers/infiniband/sw/rxe/rxe_qp.c
> index 975321812c87..54b8711321c1 100644
> --- a/drivers/infiniband/sw/rxe/rxe_qp.c
> +++ b/drivers/infiniband/sw/rxe/rxe_qp.c
> @@ -359,6 +359,7 @@ int rxe_qp_from_init(struct rxe_dev *rxe, struct rxe_qp
> *qp, struct rxe_pd *pd,
> 
>  err2:
>  	rxe_queue_cleanup(qp->sq.queue);
> +	qp->sq.queue = NULL;
>  err1:
>  	qp->pd = NULL;
>  	qp->rcq = NULL;
> 
> 
> 
> 
> 
> With regards,
> Pavel Skripkin

  reply	other threads:[~2021-11-21 14:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19  9:27 [syzbot] KASAN: use-after-free Read in rxe_queue_cleanup syzbot
2021-11-20 15:02 ` Pavel Skripkin
2021-11-21 14:15   ` Leon Romanovsky [this message]
2021-11-21 14:43     ` Zhu Yanjun
2021-11-21 20:22     ` [PATCH] RDMA: fix use-after-free " Pavel Skripkin
2021-11-22  2:04       ` Zhu Yanjun
2021-11-25 17:25       ` Jason Gunthorpe

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=YZpUnR05mK6taHs9@unreal \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paskripkin@gmail.com \
    --cc=syzbot+aab53008a5adf26abe91@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=zyjzyj2000@gmail.com \
    /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