Skip to contentSkip to conversation

efivarfs: use INODE_CHILD nested lock to traverse variables on resume

PATCH New Ard Biesheuvel 1 participant 1 message Mar 17, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efivarfs: use INODE_CHILD nested lock to traverse variables on resume

From: Ard Biesheuvel <[email protected]>

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.

---
 fs/efivarfs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/efivarfs/super.c +1 -1
index 6eae8cf655c1..642dff82f364 100644
@@ -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);
 
Signature · 1 line
2.49.0.rc1.451.g8f38331e32-goog