]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rust_binderfs: fix a dentry leak
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 26 Jan 2026 06:05:57 +0000 (01:05 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 5 Feb 2026 18:52:16 +0000 (13:52 -0500)
Parallel to binderfs patches - 02da8d2c0965 "binderfs_binder_ctl_create():
kill a bogus check" and the bit of b89aa544821d "convert binderfs" that
got lost when making 4433d8e25d73 "convert rust_binderfs"; the former is
a cleanup, the latter is about marking /binder-control persistent, so that
it would be taken out on umount.

Fixes: 4433d8e25d73 ("convert rust_binderfs")
Acked-by: Alice Ryhl <aliceryhl@google.com>
Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
drivers/android/binder/rust_binderfs.c

index c69026df775c2581562103c56abbf22159ac1380..e36011e8911665c1da8c8e1f44e3bffa2f191eae 100644 (file)
@@ -391,12 +391,6 @@ static int binderfs_binder_ctl_create(struct super_block *sb)
        if (!device)
                return -ENOMEM;
 
-       /* If we have already created a binder-control node, return. */
-       if (info->control_dentry) {
-               ret = 0;
-               goto out;
-       }
-
        ret = -ENOMEM;
        inode = new_inode(sb);
        if (!inode)
@@ -431,7 +425,8 @@ static int binderfs_binder_ctl_create(struct super_block *sb)
 
        inode->i_private = device;
        info->control_dentry = dentry;
-       d_add(dentry, inode);
+       d_make_persistent(dentry, inode);
+       dput(dentry);
 
        return 0;