Skip to contentSkip to conversation

rust_binderfs: fix a dentry leak (regression from tree-in-dcache conversion)

RFC PATCH In review Al Viro 4 participants 4 messages Feb 5

Subsystems (2)
lore
Share & tools
lore

Al Viro

author maintainer
#0 lore raw

RFC PATCH 1/1 rust_binderfs: fix a dentry leak (regression from tree-in-dcache conversion)

[just realized that this one had been sitting in #fixes without being posted - sorry]

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")
---
 drivers/android/binder/rust_binderfs.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/android/binder/rust_binderfs.c +2 -7
index c69026df775c..e36011e89116 100644
@@ -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;
 
Signature · 1 line
2.47.3
#1 lore raw
Quoted 45 lines · Al Viro

[just realized that this one had been sitting in #fixes without being posted - sorry]

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")
---
 drivers/android/binder/rust_binderfs.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/android/binder/rust_binderfs.c +2 -7
index c69026df775c..e36011e89116 100644
@@ -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;
 
Signature · 1 line
2.47.3

Nice! Want me to take this in my tree, or are you going to send this to Linus before -final happens?

thanks,

greg k-h

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Al Viro
Quoted 4 lines · Al Viro

[just realized that this one had been sitting in #fixes without being posted - sorry]

Quoted 8 lines

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")
maintainer Acked-by on v1 1/1
#3 lore raw
In reply to Al Viro
Quoted 20 lines · Al Viro

[just realized that this one had been sitting in #fixes without being posted - sorry]

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")
---
 drivers/android/binder/rust_binderfs.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/android/binder/rust_binderfs.c +0 -0
index c69026df775c..e36011e89116 100644

drivers/android/binder/rust_binderfs.c static int binderfs_binder_ctl_create(struct super_block *sb) · line 398

Quoted 8 lines
drivers/android/binder/rust_binderfs.c +0 -5
@@ -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;
-	}

I thought at some point this was supposed to have a second callpath which is probably why that check existed. Anyway, thanks for the cleanup,