Re: [PATCH] mm: Fix a NULL dereference crash while accessing bdev->bd_disk
From: Tejun Heo <tj@kernel.org>
Date: 2016-11-28 15:57:20
Also in:
linux-mm
From: Tejun Heo <tj@kernel.org>
Date: 2016-11-28 15:57:20
Also in:
linux-mm
Hello, Jan. On Mon, Nov 28, 2016 at 11:07:18AM +0100, Jan Kara wrote:
As I'm looking into the code, we need a serialization between bdev writeback and blkdev_put(). That should be doable if we use writeback_single_inode() for writing bdev inode instead of simple filemap_fdatawrite() and then use inode_wait_for_writeback() in blkdev_put() but it needs some careful thought.
It's kinda weird that sync() is ends up accessing bdev's without any synchronization. Can't we just make iterate_bdevs() grab bd_mutex and verify bd_disk isn't NULL before calling into the callback?
Frankly that whole idea of tearing block devices down on last close is a major headache and keeps biting us. I'm wondering whether it is still worth it these days...
Yeah, it'd be great if we can follow a more conventional lifetime pattern here. Thanks. -- tejun -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>