• David Howells's avatar
    Fix use after free in get_tree_bdev() · dd7bc815
    David Howells authored
    Commit 6fcf0c72, a fix to get_tree_bdev() put a missing blkdev_put() in
    the wrong place, before a warnf() that displays the bdev under
    consideration rather after it.
    
    This results in a silent lockup in printk("%pg") called via warnf() from
    get_tree_bdev() under some circumstances when there's a race with the
    blockdev being frozen.  This can be caused by xfstests/tests/generic/085 in
    combination with Lukas Czerner's ext4 mount API conversion patchset.  It
    looks like it ought to occur with other users of get_tree_bdev() such as
    XFS, but apparently doesn't.
    
    Fix this by switching the order of the lines.
    
    Fixes: 6fcf0c72 ("vfs: add missing blkdev_put() in get_tree_bdev()")
    Reported-by: default avatarLukas Czerner <lczerner@redhat.com>
    Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
    cc: Ian Kent <raven@themaw.net>
    cc: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    dd7bc815
super.c 48 KB