All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/9p/usbg: require an exact match for device tags
@ 2026-07-19  4:03 Jackie Liu
  2026-09-13  8:35 ` Dominique Martinet
  0 siblings, 1 reply; 2+ messages in thread
From: Jackie Liu @ 2026-07-19  4:03 UTC (permalink / raw)
  To: ericvh; +Cc: asmadeus, linux_oss, v9fs

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/9p/usbg: require an exact match for device tags
  2026-07-19  4:03 [PATCH] net/9p/usbg: require an exact match for device tags Jackie Liu
@ 2026-09-13  8:35 ` Dominique Martinet
  0 siblings, 0 replies; 2+ messages in thread
From: Dominique Martinet @ 2026-09-13  8:35 UTC (permalink / raw)
  To: Jackie Liu; +Cc: ericvh, linux_oss, v9fs

Jackie Liu wrote on Sun, Jul 19, 2026 at 12:03:46PM +0800:
> 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>

Thank you, there was another identical patch earlier that I hadn't
picked up yet so I'm taking their patch instead, but I've added you as
co-developed-by to the commit instead.

It should get in 7.4

https://lore.kernel.org/r/20260607121907.12588-1-zhaoyz24@mails.tsinghua.edu.cn
https://github.com/martinetd/linux/commit/9ee83ef8d24f11feb55fd0d222c0ec19f09dbd3f

-- 
Dominique Martinet | Asmadeus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-13  8:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-19  4:03 [PATCH] net/9p/usbg: require an exact match for device tags Jackie Liu
2026-09-13  8:35 ` Dominique Martinet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.