From: Chao Huang <958028483@qq.com>
To: cmllamas@google.com
Cc: gregkh@linuxfoundation.org, aliceryhl@google.com,
arve@android.com, tkjos@android.com, brauner@kernel.org,
linux-kernel@vger.kernel.org, Chao Huang <huangchao@kylinos.cn>
Subject: [PATCH v4] binderfs: free minor on binder-control creation failure
Date: Sun, 29 Nov 2026 21:27:06 +0800 [thread overview]
Message-ID: <tencent_A68EE0252BB862851ECA718E362D0ADBDC07@qq.com> (raw)
In-Reply-To: <tencent_8D7B76C623DA3A29EE73D38217ACB08AFB09@qq.com>
From: Chao Huang <huangchao@kylinos.cn>
The binderfs_binder_ctl_create() implementation in rust_binderfs.c
allocates a minor before creating the binder-control dentry. If
d_alloc_name() fails, the error path frees the device and drops the
inode, but leaves the minor allocated in binderfs_minors. Repeated
failures can therefore exhaust the global minor IDA.
Release the minor from a dedicated error path after a successful
allocation.
Fixes: eafedbc7c050 ("rust_binder: add Rust Binder driver")
Acked-by: Carlos Llamas <cmllamas@google.com>
---
Changes in v4:
- Update only rust_binderfs.c because drivers/android/binderfs.c has been
removed from the current tree.
drivers/android/binder/rust_binderfs.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/android/binder/rust_binderfs.c b/drivers/android/binder/rust_binderfs.c
index 5f020226720d..47c4ca9ea74d 100644
--- a/drivers/android/binder/rust_binderfs.c
+++ b/drivers/android/binder/rust_binderfs.c
@@ -427,7 +427,7 @@ static int binderfs_binder_ctl_create(struct super_block *sb)
dentry = d_alloc_name(root, "binder-control");
if (!dentry)
- goto out;
+ goto out_with_minor;
inode->i_private = device;
info->control_dentry = dentry;
@@ -436,6 +436,11 @@ static int binderfs_binder_ctl_create(struct super_block *sb)
return 0;
+out_with_minor:
+ mutex_lock(&binderfs_minors_mutex);
+ ida_free(&binderfs_minors, minor);
+ mutex_unlock(&binderfs_minors_mutex);
+
out:
kfree(device);
iput(inode);
--
2.54.0 (Apple Git-157)
next prev parent reply other threads:[~2026-11-29 13:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 11:23 [PATCH] " Chao Huang
2026-08-08 13:34 ` Alice Ryhl
2026-08-10 9:32 ` [PATCH v2] " Chao Huang
2026-08-10 20:16 ` Carlos Llamas
2026-08-11 1:05 ` [PATCH v3] " Chao Huang
2026-08-11 2:52 ` Carlos Llamas
2026-11-29 13:27 ` Chao Huang [this message]
2026-11-29 13:33 ` [PATCH v4] " Greg KH
2026-11-29 14:45 ` [PATCH v5] rust_binder: " Chao Huang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_A68EE0252BB862851ECA718E362D0ADBDC07@qq.com \
--to=958028483@qq.com \
--cc=aliceryhl@google.com \
--cc=arve@android.com \
--cc=brauner@kernel.org \
--cc=cmllamas@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=huangchao@kylinos.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=tkjos@android.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®