public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Hillf Danton <hdanton@sina.com>
Cc: syzbot <syzbot+478fd0d54412b8759e0d@syzkaller.appspotmail.com>,
	dledford@redhat.com, leon@kernel.org,
	linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
	michal.kalderon@marvell.com, syzkaller-bugs@googlegroups.com,
	yishaih@mellanox.com
Subject: Re: KASAN: use-after-free Read in ib_uverbs_remove_one
Date: Fri, 29 May 2020 10:09:54 -0300	[thread overview]
Message-ID: <20200529130954.GA21651@ziepe.ca> (raw)
In-Reply-To: <20200529083126.15808-1-hdanton@sina.com>

On Fri, May 29, 2020 at 04:31:26PM +0800, Hillf Danton wrote:
> Hold another grab to dev to prevent it from going home before work gets
> done with it.
> 
> +++ b/drivers/infiniband/core/uverbs_main.c
> @@ -1152,6 +1152,8 @@ static int ib_uverbs_add_one(struct ib_d
>  		  device->ops.mmap ? &uverbs_mmap_fops : &uverbs_fops);
>  	uverbs_dev->cdev.owner = THIS_MODULE;
>  
> +	/* pair with put_device() in ib_uverbs_remove_one() */
> +	get_device(&uverbs_dev->dev);
>  	ret = cdev_device_add(&uverbs_dev->cdev, &uverbs_dev->dev);
>  	if (ret)
>  		goto err_uapi;

Doesn't look right, the put_device() in uverbs_remove_one() pairs with
the device_initialize() in this function.

The only thing I can think of is we called remove_once twice
somehow or had an extra put on some error path. But I couldn't find
any flow that would do either of those things

Jason

  parent reply	other threads:[~2020-05-29 13:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28 14:33 KASAN: use-after-free Read in ib_uverbs_remove_one syzbot
     [not found] ` <20200529083126.15808-1-hdanton@sina.com>
2020-05-29 13:09   ` Jason Gunthorpe [this message]
2020-05-30  0:13 ` 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=20200529130954.GA21651@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=dledford@redhat.com \
    --cc=hdanton@sina.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=michal.kalderon@marvell.com \
    --cc=syzbot+478fd0d54412b8759e0d@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=yishaih@mellanox.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