public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
* [PATCH] ext4: WARNING: locking bug in ext4_ioctl
@ 2024-09-27 16:51 Remington Brasga
  2024-09-27 18:59 ` [syzbot] [ext4?] " syzbot
  0 siblings, 1 reply; 3+ messages in thread
From: Remington Brasga @ 2024-09-27 16:51 UTC (permalink / raw)
  To: Theodore Ts'o, Andreas Dilger, Shuah Khan
  Cc: linux-ext4, linux-kernel, linux-kernel-mentees,
	syzbot+a3c8e9ac9f9d77240afd, Remington Brasga

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread
[parent not found: <000000000000d1149605fd5b0c0d@google.com>]

end of thread, other threads:[~2025-01-07  7:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-27 16:51 [PATCH] ext4: WARNING: locking bug in ext4_ioctl Remington Brasga
2024-09-27 18:59 ` [syzbot] [ext4?] " syzbot
     [not found] <000000000000d1149605fd5b0c0d@google.com>
2025-01-07  7:48 ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox