Re: [PATCH] net/9p/usbg: fix prefix matching in device lookup
From: Dominique Martinet
Date: Sun Sep 13 2026 - 04:35:04 EST
Yizhou Zhao wrote on Sun, Jun 07, 2026 at 08:19:04PM +0800:
> p9_usbg_create() matches the mount source against registered usb9pfs
> instance tags with strncmp() and the length of the caller supplied source.
> That accepts any prefix of the registered tag.
>
> For example, a gadget instance tagged "secret_channel" can be selected with
> "s", "sec", or any other non-empty prefix. Once selected, the instance is
> marked in use and the client is attached to that transport. This differs
> from the configfs tag lookup path, which uses strcmp() and therefore
> requires an exact tag match.
>
> Require an exact tag match in p9_usbg_create() as well.
>
> Fixes: a3be076dc174 ("net/9p/usbg: Add new usb gadget function transport")
> Cc: stable@xxxxxxxxxxxxxxx
> Reported-by: Yizhou Zhao <zhaoyz24@xxxxxxxxxxxxxxxxxxxxx>
> Reported-by: Yuxiang Yang <yangyx22@xxxxxxxxxxxxxxxxxxxxx>
> Reported-by: Ao Wang <wangao@xxxxxxxxxx>
> Reported-by: Xuewei Feng <fengxw06@xxxxxxx>
> Reported-by: Qi Li <qli01@xxxxxxxxxxxxxxx>
> Reported-by: Ke Xu <xuke@xxxxxxxxxxxxxxx>
> Assisted-by: GLM:GLM-5.1
> Signed-off-by: Yizhou Zhao <zhaoyz24@xxxxxxxxxxxxxxxxxxxxx>
Thanks, there was another identical patch later so I did the same
(actually just adding co-authored-by, I kept the commit message the
same)
I'm honestly not sure what to do in these case but there's probably no
harm in overcrediting...
https://lore.kernel.org/r/20260719040346.88295-1-liu.yun@xxxxxxxxx
https://github.com/martinetd/linux/commit/9ee83ef8d24f11feb55fd0d222c0ec19f09dbd3f
--
Dominique