Commit dec12778 authored by Ard Biesheuvel's avatar Ard Biesheuvel
Browse files

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: default avatar <syzbot+019072ad24ab1d948228@syzkaller.appspotmail.com>
Suggested-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
parent cb16dfed
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);