summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2025-03-17 10:23:11 +0300
committerArd Biesheuvel <ardb@kernel.org>2025-03-17 20:19:02 +0300
commitdec1277875a5974413068bfb67df7e87e51a189b (patch)
tree76c2fc5a217054ec4877cd55296bc34306b755ba
parentcb16dfed0093217a68c0faa9394fa5823927e04c (diff)
downloadlinux-dec1277875a5974413068bfb67df7e87e51a189b.tar.xz
efivarfs: use I_MUTEX_CHILD nested lock to traverse variables on resume
syzbot warns about a potential deadlock, but this is a false positive resulting from a missing lockdep annotation: iterate_dir() locks the parent whereas the inode_lock() it warns about locks the child, which is guaranteed to be a different lock. So use inode_lock_nested() instead with the appropriate lock class. Reported-by: syzbot+019072ad24ab1d948228@syzkaller.appspotmail.com Suggested-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
-rw-r--r--fs/efivarfs/super.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c
index 6eae8cf655c1..42295d04f08d 100644
--- a/fs/efivarfs/super.c
+++ b/fs/efivarfs/super.c
@@ -421,7 +421,7 @@ static bool efivarfs_actor(struct dir_context *ctx, const char *name, int len,
if (err)
size = 0;
- inode_lock(inode);
+ inode_lock_nested(inode, I_MUTEX_CHILD);
i_size_write(inode, size);
inode_unlock(inode);