]> git.hungrycats.org Git - linux/commit
loop: fix LOOP_GET_STATUS lock imbalance
authorOmar Sandoval <osandov@fb.com>
Fri, 6 Apr 2018 16:57:03 +0000 (09:57 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 May 2018 14:46:10 +0000 (16:46 +0200)
commit0725281a6185046e23190bc749f707a145b2b2dc
treee9e7fed99883377d81055656c5c328fee59677f5
parent9a0e8aa0f0f2e8df4703c53b2a7f59a02b98a8da
loop: fix LOOP_GET_STATUS lock imbalance

commit bdac616db9bbadb90b7d6a406144571015e138f7 upstream.

Commit 2d1d4c1e591f made loop_get_status() drop lo_ctx_mutex before
returning, but the loop_get_status_old(), loop_get_status64(), and
loop_get_status_compat() wrappers don't call loop_get_status() if the
passed argument is NULL. The callers expect that the lock is dropped, so
make sure we drop it in that case, too.

Reported-by: syzbot+31e8daa8b3fc129e75f2@syzkaller.appspotmail.com
Fixes: 2d1d4c1e591f ("loop: don't call into filesystem while holding lo_ctl_mutex")
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/loop.c