Commit 17b5e4b
loop: Fix ABBA locking race
[ Upstream commit b491255 ]
Current loop calls vfs_statfs() while holding the q->limits_lock. If
FS takes some locking in vfs_statfs callback, this may lead to ABBA
locking bug (at least, FAT fs has this issue actually).
So this patch calls vfs_statfs() outside q->limits_locks instead,
because looks like no reason to hold q->limits_locks while getting
discord configs.
Chain exists of:
&sbi->fat_lock --> &q->q_usage_counter(io)#17 --> &q->limits_lock
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&q->limits_lock);
lock(&q->q_usage_counter(io)#17);
lock(&q->limits_lock);
lock(&sbi->fat_lock);
*** DEADLOCK ***
Reported-by: syzbot+a5d8c609c02f508672cc@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=a5d8c609c02f508672cc
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Stable-dep-of: f5c84ef ("loop: Add sanity check for read/write_iter")
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 0558ce095b767ab70e686f556f9adfb1805812fb)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>1 parent 0bf91a7 commit 17b5e4b
1 file changed
+15
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
694 | 694 | | |
695 | 695 | | |
696 | 696 | | |
697 | | - | |
698 | | - | |
| 697 | + | |
| 698 | + | |
699 | 699 | | |
700 | 700 | | |
701 | 701 | | |
702 | | - | |
703 | 702 | | |
704 | 703 | | |
705 | 704 | | |
| |||
712 | 711 | | |
713 | 712 | | |
714 | 713 | | |
715 | | - | |
716 | | - | |
| 714 | + | |
| 715 | + | |
717 | 716 | | |
718 | 717 | | |
719 | 718 | | |
720 | 719 | | |
721 | 720 | | |
722 | 721 | | |
723 | | - | |
724 | | - | |
| 722 | + | |
| 723 | + | |
725 | 724 | | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | 725 | | |
734 | 726 | | |
735 | 727 | | |
| |||
915 | 907 | | |
916 | 908 | | |
917 | 909 | | |
| 910 | + | |
918 | 911 | | |
919 | 912 | | |
920 | 913 | | |
| |||
924 | 917 | | |
925 | 918 | | |
926 | 919 | | |
| 920 | + | |
| 921 | + | |
927 | 922 | | |
928 | 923 | | |
929 | 924 | | |
| |||
933 | 928 | | |
934 | 929 | | |
935 | 930 | | |
936 | | - | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
937 | 937 | | |
938 | 938 | | |
939 | 939 | | |
| |||
0 commit comments