Re: block: Fix oops caused by __blkdev_get() calling disk_unblock_events()with invalid @disk

From: Jens Axboe
Date: Wed Mar 09 2011 - 13:27:06 EST


On 2011-03-09 16:38, Tejun Heo wrote:
> Commit 57c966b8b2 (block: Don't check events while open is in
> progress) made __blkdev_get() block events around open calls; however,
> it used invalid @disk pointer in the following cases.
>
> * When ->open() returns -ERESTARTSYS, disk_unblock_events() is called
> after @disk is put. @disk may be invalid by the time unblock is
> called.
>
> This is fixed by moving references after disk_unblock_events().
>
> * When there are multiple openers, @disk is cleared to %NULL and later
> disk_unblock_disk() is called with %NULL @disk causing oops.
>
> This is fixed by moving reference putting after open success is
> determined and not clearing @disk to %NULL. On success, @disk is
> valid because there is another opener holding reference to it. On
> failure, the references are put after disk_unblock_events() is
> called.

Thanks, applied. A bit unfortunate to have a 100% crasher in the tree,
though. Will suck for bisects.

--
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/