Re: [PATCH] bdev: fix NULL pointer dereference in sync()/close() race

From: Tejun Heo
Date: Mon Aug 29 2016 - 16:54:47 EST


Hello,

On Mon, Aug 29, 2016 at 10:49:57PM +0200, Vegard Nossum wrote:
> That didn't work at all. I guess bd_acquire() would just do a bdgrab()
> and not touch ->bd_holders, whereas blkdev_get() would increment

Yeah, bdev has two different refs - one for bdev struct itself and the
other for the actual accessors.

> bd_holders and therefore prevent __blkdev_put() from freeing the block
> device? Too confusing...

I think you'll need to do the actual blkdev_get or one of its
variants.

Thanks.

--
tejun