From: Remington Brasga <rbrasga@uci.edu>
To: Theodore Ts'o <tytso@mit.edu>,
Andreas Dilger <adilger.kernel@dilger.ca>,
Shuah Khan <skhan@linuxfoundation.org>
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kernel-mentees@lists.linuxfoundation.org,
syzbot+a3c8e9ac9f9d77240afd@syzkaller.appspotmail.com,
Remington Brasga <rbrasga@uci.edu>
Subject: [PATCH] ext4: WARNING: locking bug in ext4_ioctl
Date: Fri, 27 Sep 2024 16:51:32 +0000 [thread overview]
Message-ID: <20240927165132.17289-1-rbrasga@uci.edu> (raw)
Fixed the locking bug with the bisection found by syzbot.
Link to the syzbot bug report:
https://syzkaller.appspot.com/bug?extid=a3c8e9ac9f9d77240afd
Reported-by: syzbot+a3c8e9ac9f9d77240afd@syzkaller.appspotmail.com
Signed-off-by: Remington Brasga <rbrasga@uci.edu>
---
First attempt at patching this issue. Verified the bug exists, and that
this patch fixes it, and EXT4 KUnit tests pass. Though I am not sure if
the patch should be higher up the stack.
Open to questions or any suggestions for improvements.
#syz test
fs/ext4/xattr.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index e0e1956dcdd3..2b30b9571fd8 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -124,8 +124,12 @@ void ext4_xattr_inode_set_class(struct inode *ea_inode)
struct ext4_inode_info *ei = EXT4_I(ea_inode);
lockdep_set_subclass(&ea_inode->i_rwsem, 1);
- (void) ei; /* shut up clang warning if !CONFIG_LOCKDEP */
- lockdep_set_subclass(&ei->i_data_sem, I_DATA_SEM_EA);
+
+ if (ei->i_flags & EXT4_EA_INODE_FL) {
+ lockdep_set_subclass(&ei->i_data_sem, I_DATA_SEM_EA);
+ } else {
+ lockdep_set_subclass(&ei->i_data_sem, I_DATA_SEM_NORMAL);
+ }
}
#endif
--
2.34.1
next reply other threads:[~2024-09-27 16:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-27 16:51 Remington Brasga [this message]
2024-09-27 18:59 ` [syzbot] [ext4?] WARNING: locking bug in ext4_ioctl syzbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240927165132.17289-1-rbrasga@uci.edu \
--to=rbrasga@uci.edu \
--cc=adilger.kernel@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=syzbot+a3c8e9ac9f9d77240afd@syzkaller.appspotmail.com \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox