All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efivarfs: use INODE_CHILD nested lock to traverse variables on resume
@ 2025-03-17  7:30 Ard Biesheuvel
  0 siblings, 0 replies; only message in thread
From: Ard Biesheuvel @ 2025-03-17  7:30 UTC (permalink / raw)
  To: linux-efi
  Cc: James.Bottomley, Ard Biesheuvel, syzbot+019072ad24ab1d948228,
	Al Viro

From: Ard Biesheuvel <ardb@kernel.org>

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>
---
 fs/efivarfs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c
index 6eae8cf655c1..642dff82f364 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, INODE_CHILD);
 	i_size_write(inode, size);
 	inode_unlock(inode);
 
-- 
2.49.0.rc1.451.g8f38331e32-goog


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-03-17  7:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-17  7:30 [PATCH] efivarfs: use INODE_CHILD nested lock to traverse variables on resume Ard Biesheuvel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.