]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
fix locking in efi_secret_unlink()
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 14 May 2024 14:48:58 +0000 (08:48 -0600)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 11 Jun 2025 22:00:31 +0000 (18:00 -0400)
We used to need securityfs_remove() to undo simple_pin_fs() done when
the file had been created and to drop the second extra reference
taken at the same time.  Now that neither is needed (or done by
securityfs_remove()), we can simply call simple_unlink() and be done
with that - the broken games with locking had been there only for the
sake of securityfs_remove().

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
drivers/virt/coco/efi_secret/efi_secret.c

index 1864f9f80617e082feb574a15327949972c8cc1e..f2da4819ec3b7d327a2b495915b6b666f5e941c5 100644 (file)
@@ -136,15 +136,7 @@ static int efi_secret_unlink(struct inode *dir, struct dentry *dentry)
                if (s->fs_files[i] == dentry)
                        s->fs_files[i] = NULL;
 
-       /*
-        * securityfs_remove tries to lock the directory's inode, but we reach
-        * the unlink callback when it's already locked
-        */
-       inode_unlock(dir);
-       securityfs_remove(dentry);
-       inode_lock(dir);
-
-       return 0;
+       return simple_unlink(inode, dentry);
 }
 
 static const struct inode_operations efi_secret_dir_inode_operations = {