From: Jackie Liu <liu.yun@linux.dev>
To: ericvh@kernel.org
Cc: asmadeus@codewreck.org, linux_oss@crudebyte.com, v9fs@lists.linux.dev
Subject: [PATCH] net/9p/usbg: require an exact match for device tags
Date: Sun, 19 Jul 2026 12:03:46 +0800 [thread overview]
Message-ID: <20260719040346.88295-1-liu.yun@linux.dev> (raw)
From: Jackie Liu <liuyun01@kylinos.cn>
p9_usbg_create() compares only strlen(devname) bytes while looking up the
configfs instance named by the mount source. A source that is a prefix of
an instance name therefore selects that instance. For example, source
"foo" binds the "foobar" channel instead of failing with -ENOENT.
The configfs layer passes the instance name to usb9pfs_set_inst_tag(), and
the transport already uses full string comparisons to keep these names
unique. Use an exact match for mount lookup too.
Fixes: a3be076dc174 ("net/9p/usbg: Add new usb gadget function transport")
Cc: stable@vger.kernel.org
Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
---
net/9p/trans_usbg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/9p/trans_usbg.c b/net/9p/trans_usbg.c
index 419cda13a7b5..884d6f4af50c 100644
--- a/net/9p/trans_usbg.c
+++ b/net/9p/trans_usbg.c
@@ -391,7 +391,7 @@ static int p9_usbg_create(struct p9_client *client, struct fs_context *fc)
guard(mutex)(&usb9pfs_lock);
list_for_each_entry(dev, &usbg_instance_list, usb9pfs_instance) {
- if (!strncmp(devname, dev->tag, strlen(devname))) {
+ if (!strcmp(devname, dev->tag)) {
if (!dev->inuse) {
dev->inuse = true;
found = 1;
--
2.54.0
reply other threads:[~2026-07-19 4:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260719040346.88295-1-liu.yun@linux.dev \
--to=liu.yun@linux.dev \
--cc=asmadeus@codewreck.org \
--cc=ericvh@kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=v9fs@lists.linux.dev \
/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