* [PATCH] usb: gadget: f_uac1_legacy: fix inverted NULL check after kstrndup()
@ 2026-06-25 11:31 Xu Yang
2026-06-25 12:15 ` Frank Li
2026-07-08 15:05 ` Greg KH
0 siblings, 2 replies; 9+ messages in thread
From: Xu Yang @ 2026-06-25 11:31 UTC (permalink / raw)
To: gregkh, kees, christophe.jaillet, xu.yang_2, hataegu0826
Cc: balbi, andrzej.p, linux-usb, linux-kernel, imx
From: Xu Yang <xu.yang_2@nxp.com>
kstrndup() returns NULL on allocation failure. The condition was
checking 'if (tmp)' to detect failure, but this is inverted — it
would treat a successful allocation as an error and return -ENOMEM
while leaking the string, and proceed with a NULL pointer on failure.
Fix by changing the condition to 'if (!tmp)'.
Fixes: 0854611a19ae ("usb: gadget: f_uac1: add configfs support")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-sonnet-4-6
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
drivers/usb/gadget/function/f_uac1_legacy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/function/f_uac1_legacy.c b/drivers/usb/gadget/function/f_uac1_legacy.c
index 5d201a2e30e7..e9f2632ce785 100644
--- a/drivers/usb/gadget/function/f_uac1_legacy.c
+++ b/drivers/usb/gadget/function/f_uac1_legacy.c
@@ -914,7 +914,7 @@ static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \
goto end; \
\
tmp = kstrndup(page, len, GFP_KERNEL); \
- if (tmp) { \
+ if (!tmp) { \
ret = -ENOMEM; \
goto end; \
} \
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: gadget: f_uac1_legacy: fix inverted NULL check after kstrndup()
2026-06-25 11:31 [PATCH] usb: gadget: f_uac1_legacy: fix inverted NULL check after kstrndup() Xu Yang
@ 2026-06-25 12:15 ` Frank Li
2026-07-08 15:05 ` Greg KH
1 sibling, 0 replies; 9+ messages in thread
From: Frank Li @ 2026-06-25 12:15 UTC (permalink / raw)
To: Xu Yang
Cc: gregkh, kees, christophe.jaillet, xu.yang_2, hataegu0826, balbi,
andrzej.p, linux-usb, linux-kernel, imx
On Thu, Jun 25, 2026 at 07:31:54PM +0800, Xu Yang wrote:
>
> From: Xu Yang <xu.yang_2@nxp.com>
>
> kstrndup() returns NULL on allocation failure. The condition was
> checking 'if (tmp)' to detect failure, but this is inverted — it
> would treat a successful allocation as an error and return -ENOMEM
> while leaking the string, and proceed with a NULL pointer on failure.
>
> Fix by changing the condition to 'if (!tmp)'.
>
> Fixes: 0854611a19ae ("usb: gadget: f_uac1: add configfs support")
> Cc: stable@vger.kernel.org
> Assisted-by: Claude:claude-sonnet-4-6
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/usb/gadget/function/f_uac1_legacy.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/function/f_uac1_legacy.c b/drivers/usb/gadget/function/f_uac1_legacy.c
> index 5d201a2e30e7..e9f2632ce785 100644
> --- a/drivers/usb/gadget/function/f_uac1_legacy.c
> +++ b/drivers/usb/gadget/function/f_uac1_legacy.c
> @@ -914,7 +914,7 @@ static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \
> goto end; \
> \
> tmp = kstrndup(page, len, GFP_KERNEL); \
> - if (tmp) { \
> + if (!tmp) { \
> ret = -ENOMEM; \
> goto end; \
> } \
> --
> 2.34.1
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: gadget: f_uac1_legacy: fix inverted NULL check after kstrndup()
2026-06-25 11:31 [PATCH] usb: gadget: f_uac1_legacy: fix inverted NULL check after kstrndup() Xu Yang
2026-06-25 12:15 ` Frank Li
@ 2026-07-08 15:05 ` Greg KH
2026-07-08 20:54 ` Frank Li
1 sibling, 1 reply; 9+ messages in thread
From: Greg KH @ 2026-07-08 15:05 UTC (permalink / raw)
To: Xu Yang
Cc: kees, christophe.jaillet, xu.yang_2, hataegu0826, balbi,
andrzej.p, linux-usb, linux-kernel, imx
On Thu, Jun 25, 2026 at 07:31:54PM +0800, Xu Yang wrote:
> From: Xu Yang <xu.yang_2@nxp.com>
>
> kstrndup() returns NULL on allocation failure. The condition was
> checking 'if (tmp)' to detect failure, but this is inverted — it
> would treat a successful allocation as an error and return -ENOMEM
> while leaking the string, and proceed with a NULL pointer on failure.
>
> Fix by changing the condition to 'if (!tmp)'.
>
> Fixes: 0854611a19ae ("usb: gadget: f_uac1: add configfs support")
> Cc: stable@vger.kernel.org
> Assisted-by: Claude:claude-sonnet-4-6
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> ---
> drivers/usb/gadget/function/f_uac1_legacy.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/function/f_uac1_legacy.c b/drivers/usb/gadget/function/f_uac1_legacy.c
> index 5d201a2e30e7..e9f2632ce785 100644
> --- a/drivers/usb/gadget/function/f_uac1_legacy.c
> +++ b/drivers/usb/gadget/function/f_uac1_legacy.c
> @@ -914,7 +914,7 @@ static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \
> goto end; \
> \
> tmp = kstrndup(page, len, GFP_KERNEL); \
> - if (tmp) { \
> + if (!tmp) { \
> ret = -ENOMEM; \
> goto end; \
> } \
> --
> 2.34.1
>
>
So this has never worked? How has no one ever noticed that in the
decade this has been in the kernel? Does that mean that no one uses
this file/driver and we can just remove it?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: gadget: f_uac1_legacy: fix inverted NULL check after kstrndup()
2026-07-08 15:05 ` Greg KH
@ 2026-07-08 20:54 ` Frank Li
2026-07-09 5:33 ` Greg KH
2026-07-09 16:39 ` David Laight
0 siblings, 2 replies; 9+ messages in thread
From: Frank Li @ 2026-07-08 20:54 UTC (permalink / raw)
To: Greg KH
Cc: Xu Yang, kees, christophe.jaillet, xu.yang_2, hataegu0826, balbi,
andrzej.p, linux-usb, linux-kernel, imx
On Wed, Jul 08, 2026 at 05:05:03PM +0200, Greg KH wrote:
> On Thu, Jun 25, 2026 at 07:31:54PM +0800, Xu Yang wrote:
> > From: Xu Yang <xu.yang_2@nxp.com>
> >
> > kstrndup() returns NULL on allocation failure. The condition was
> > checking 'if (tmp)' to detect failure, but this is inverted — it
> > would treat a successful allocation as an error and return -ENOMEM
> > while leaking the string, and proceed with a NULL pointer on failure.
> >
> > Fix by changing the condition to 'if (!tmp)'.
> >
> > Fixes: 0854611a19ae ("usb: gadget: f_uac1: add configfs support")
> > Cc: stable@vger.kernel.org
> > Assisted-by: Claude:claude-sonnet-4-6
> > Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> > ---
> > drivers/usb/gadget/function/f_uac1_legacy.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/usb/gadget/function/f_uac1_legacy.c b/drivers/usb/gadget/function/f_uac1_legacy.c
> > index 5d201a2e30e7..e9f2632ce785 100644
> > --- a/drivers/usb/gadget/function/f_uac1_legacy.c
> > +++ b/drivers/usb/gadget/function/f_uac1_legacy.c
> > @@ -914,7 +914,7 @@ static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \
> > goto end; \
> > \
> > tmp = kstrndup(page, len, GFP_KERNEL); \
> > - if (tmp) { \
> > + if (!tmp) { \
> > ret = -ENOMEM; \
> > goto end; \
> > } \
> > --
> > 2.34.1
> >
> >
>
> So this has never worked? How has no one ever noticed that in the
> decade this has been in the kernel? Does that mean that no one uses
> this file/driver and we can just remove it?
I think just no one use sys interface to change name.
Frank
>
> thanks,
>
> greg k-h
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: gadget: f_uac1_legacy: fix inverted NULL check after kstrndup()
2026-07-08 20:54 ` Frank Li
@ 2026-07-09 5:33 ` Greg KH
2026-07-09 6:23 ` Xu Yang
2026-07-09 16:39 ` David Laight
1 sibling, 1 reply; 9+ messages in thread
From: Greg KH @ 2026-07-09 5:33 UTC (permalink / raw)
To: Frank Li
Cc: Xu Yang, kees, christophe.jaillet, xu.yang_2, hataegu0826, balbi,
andrzej.p, linux-usb, linux-kernel, imx
On Wed, Jul 08, 2026 at 03:54:03PM -0500, Frank Li wrote:
> On Wed, Jul 08, 2026 at 05:05:03PM +0200, Greg KH wrote:
> > On Thu, Jun 25, 2026 at 07:31:54PM +0800, Xu Yang wrote:
> > > From: Xu Yang <xu.yang_2@nxp.com>
> > >
> > > kstrndup() returns NULL on allocation failure. The condition was
> > > checking 'if (tmp)' to detect failure, but this is inverted — it
> > > would treat a successful allocation as an error and return -ENOMEM
> > > while leaking the string, and proceed with a NULL pointer on failure.
> > >
> > > Fix by changing the condition to 'if (!tmp)'.
> > >
> > > Fixes: 0854611a19ae ("usb: gadget: f_uac1: add configfs support")
> > > Cc: stable@vger.kernel.org
> > > Assisted-by: Claude:claude-sonnet-4-6
> > > Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> > > ---
> > > drivers/usb/gadget/function/f_uac1_legacy.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/usb/gadget/function/f_uac1_legacy.c b/drivers/usb/gadget/function/f_uac1_legacy.c
> > > index 5d201a2e30e7..e9f2632ce785 100644
> > > --- a/drivers/usb/gadget/function/f_uac1_legacy.c
> > > +++ b/drivers/usb/gadget/function/f_uac1_legacy.c
> > > @@ -914,7 +914,7 @@ static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \
> > > goto end; \
> > > \
> > > tmp = kstrndup(page, len, GFP_KERNEL); \
> > > - if (tmp) { \
> > > + if (!tmp) { \
> > > ret = -ENOMEM; \
> > > goto end; \
> > > } \
> > > --
> > > 2.34.1
> > >
> > >
> >
> > So this has never worked? How has no one ever noticed that in the
> > decade this has been in the kernel? Does that mean that no one uses
> > this file/driver and we can just remove it?
>
> I think just no one use sys interface to change name.
So it can just be removed? Please submit a patch to do that instead.
Ideally this whole file can be removed, does anyone still use it?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: gadget: f_uac1_legacy: fix inverted NULL check after kstrndup()
2026-07-09 5:33 ` Greg KH
@ 2026-07-09 6:23 ` Xu Yang
2026-07-09 6:48 ` Greg KH
0 siblings, 1 reply; 9+ messages in thread
From: Xu Yang @ 2026-07-09 6:23 UTC (permalink / raw)
To: Greg KH
Cc: Frank Li, kees, christophe.jaillet, xu.yang_2, hataegu0826, balbi,
andrzej.p, linux-usb, linux-kernel, imx
On Thu, Jul 09, 2026 at 07:33:03AM +0200, Greg KH wrote:
> On Wed, Jul 08, 2026 at 03:54:03PM -0500, Frank Li wrote:
> > On Wed, Jul 08, 2026 at 05:05:03PM +0200, Greg KH wrote:
> > > On Thu, Jun 25, 2026 at 07:31:54PM +0800, Xu Yang wrote:
> > > > From: Xu Yang <xu.yang_2@nxp.com>
> > > >
> > > > kstrndup() returns NULL on allocation failure. The condition was
> > > > checking 'if (tmp)' to detect failure, but this is inverted — it
> > > > would treat a successful allocation as an error and return -ENOMEM
> > > > while leaking the string, and proceed with a NULL pointer on failure.
> > > >
> > > > Fix by changing the condition to 'if (!tmp)'.
> > > >
> > > > Fixes: 0854611a19ae ("usb: gadget: f_uac1: add configfs support")
> > > > Cc: stable@vger.kernel.org
> > > > Assisted-by: Claude:claude-sonnet-4-6
> > > > Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> > > > ---
> > > > drivers/usb/gadget/function/f_uac1_legacy.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/usb/gadget/function/f_uac1_legacy.c b/drivers/usb/gadget/function/f_uac1_legacy.c
> > > > index 5d201a2e30e7..e9f2632ce785 100644
> > > > --- a/drivers/usb/gadget/function/f_uac1_legacy.c
> > > > +++ b/drivers/usb/gadget/function/f_uac1_legacy.c
> > > > @@ -914,7 +914,7 @@ static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \
> > > > goto end; \
> > > > \
> > > > tmp = kstrndup(page, len, GFP_KERNEL); \
> > > > - if (tmp) { \
> > > > + if (!tmp) { \
> > > > ret = -ENOMEM; \
> > > > goto end; \
> > > > } \
> > > > --
> > > > 2.34.1
> > > >
> > > >
> > >
> > > So this has never worked? How has no one ever noticed that in the
> > > decade this has been in the kernel? Does that mean that no one uses
> > > this file/driver and we can just remove it?
> >
> > I think just no one use sys interface to change name.
>
> So it can just be removed? Please submit a patch to do that instead.
>
> Ideally this whole file can be removed, does anyone still use it?
This legacy driver is still built in kernel in multi_v7_defconfig:
~/work/usb$ grep -nr CONFIG_USB_CONFIGFS_F_UAC1_LEGACY arch/*/configs/
arch/arm/configs/multi_v7_defconfig:939:CONFIG_USB_CONFIGFS_F_UAC1_LEGACY=y
It seems we can't simply remove it.
BTW, do we have other ways to figure out if it can be removed?
Thanks,
Xu Yang
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: gadget: f_uac1_legacy: fix inverted NULL check after kstrndup()
2026-07-09 6:23 ` Xu Yang
@ 2026-07-09 6:48 ` Greg KH
2026-07-10 12:58 ` Greg KH
0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2026-07-09 6:48 UTC (permalink / raw)
To: Xu Yang
Cc: Frank Li, kees, christophe.jaillet, xu.yang_2, hataegu0826, balbi,
andrzej.p, linux-usb, linux-kernel, imx
On Thu, Jul 09, 2026 at 02:23:51PM +0800, Xu Yang wrote:
> On Thu, Jul 09, 2026 at 07:33:03AM +0200, Greg KH wrote:
> > On Wed, Jul 08, 2026 at 03:54:03PM -0500, Frank Li wrote:
> > > On Wed, Jul 08, 2026 at 05:05:03PM +0200, Greg KH wrote:
> > > > On Thu, Jun 25, 2026 at 07:31:54PM +0800, Xu Yang wrote:
> > > > > From: Xu Yang <xu.yang_2@nxp.com>
> > > > >
> > > > > kstrndup() returns NULL on allocation failure. The condition was
> > > > > checking 'if (tmp)' to detect failure, but this is inverted — it
> > > > > would treat a successful allocation as an error and return -ENOMEM
> > > > > while leaking the string, and proceed with a NULL pointer on failure.
> > > > >
> > > > > Fix by changing the condition to 'if (!tmp)'.
> > > > >
> > > > > Fixes: 0854611a19ae ("usb: gadget: f_uac1: add configfs support")
> > > > > Cc: stable@vger.kernel.org
> > > > > Assisted-by: Claude:claude-sonnet-4-6
> > > > > Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> > > > > ---
> > > > > drivers/usb/gadget/function/f_uac1_legacy.c | 2 +-
> > > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/usb/gadget/function/f_uac1_legacy.c b/drivers/usb/gadget/function/f_uac1_legacy.c
> > > > > index 5d201a2e30e7..e9f2632ce785 100644
> > > > > --- a/drivers/usb/gadget/function/f_uac1_legacy.c
> > > > > +++ b/drivers/usb/gadget/function/f_uac1_legacy.c
> > > > > @@ -914,7 +914,7 @@ static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \
> > > > > goto end; \
> > > > > \
> > > > > tmp = kstrndup(page, len, GFP_KERNEL); \
> > > > > - if (tmp) { \
> > > > > + if (!tmp) { \
> > > > > ret = -ENOMEM; \
> > > > > goto end; \
> > > > > } \
> > > > > --
> > > > > 2.34.1
> > > > >
> > > > >
> > > >
> > > > So this has never worked? How has no one ever noticed that in the
> > > > decade this has been in the kernel? Does that mean that no one uses
> > > > this file/driver and we can just remove it?
> > >
> > > I think just no one use sys interface to change name.
> >
> > So it can just be removed? Please submit a patch to do that instead.
> >
> > Ideally this whole file can be removed, does anyone still use it?
>
> This legacy driver is still built in kernel in multi_v7_defconfig:
>
> ~/work/usb$ grep -nr CONFIG_USB_CONFIGFS_F_UAC1_LEGACY arch/*/configs/
> arch/arm/configs/multi_v7_defconfig:939:CONFIG_USB_CONFIGFS_F_UAC1_LEGACY=y
defconfig doesn't mean much. Perhaps look at some of the Android
configs?
> It seems we can't simply remove it.
Why?
> BTW, do we have other ways to figure out if it can be removed?
Remove it and see who complains? :)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: gadget: f_uac1_legacy: fix inverted NULL check after kstrndup()
2026-07-08 20:54 ` Frank Li
2026-07-09 5:33 ` Greg KH
@ 2026-07-09 16:39 ` David Laight
1 sibling, 0 replies; 9+ messages in thread
From: David Laight @ 2026-07-09 16:39 UTC (permalink / raw)
To: Frank Li
Cc: Greg KH, Xu Yang, kees, christophe.jaillet, xu.yang_2,
hataegu0826, balbi, andrzej.p, linux-usb, linux-kernel, imx
On Wed, 8 Jul 2026 15:54:03 -0500
Frank Li <Frank.li@oss.nxp.com> wrote:
> On Wed, Jul 08, 2026 at 05:05:03PM +0200, Greg KH wrote:
> > On Thu, Jun 25, 2026 at 07:31:54PM +0800, Xu Yang wrote:
> > > From: Xu Yang <xu.yang_2@nxp.com>
> > >
> > > kstrndup() returns NULL on allocation failure. The condition was
> > > checking 'if (tmp)' to detect failure, but this is inverted — it
> > > would treat a successful allocation as an error and return -ENOMEM
> > > while leaking the string, and proceed with a NULL pointer on failure.
> > >
> > > Fix by changing the condition to 'if (!tmp)'.
> > >
> > > Fixes: 0854611a19ae ("usb: gadget: f_uac1: add configfs support")
> > > Cc: stable@vger.kernel.org
> > > Assisted-by: Claude:claude-sonnet-4-6
> > > Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> > > ---
> > > drivers/usb/gadget/function/f_uac1_legacy.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/usb/gadget/function/f_uac1_legacy.c b/drivers/usb/gadget/function/f_uac1_legacy.c
> > > index 5d201a2e30e7..e9f2632ce785 100644
> > > --- a/drivers/usb/gadget/function/f_uac1_legacy.c
> > > +++ b/drivers/usb/gadget/function/f_uac1_legacy.c
> > > @@ -914,7 +914,7 @@ static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \
> > > goto end; \
> > > \
> > > tmp = kstrndup(page, len, GFP_KERNEL); \
> > > - if (tmp) { \
> > > + if (!tmp) { \
> > > ret = -ENOMEM; \
> > > goto end; \
> > > } \
> > > --
> > > 2.34.1
> > >
> > >
> >
> > So this has never worked? How has no one ever noticed that in the
> > decade this has been in the kernel? Does that mean that no one uses
> > this file/driver and we can just remove it?
>
> I think just no one use sys interface to change name.
Or doesn't notice/care that is didn't work and didn't try often
enough to leak enough memory to break things.
David
>
> Frank
>
> >
> > thanks,
> >
> > greg k-h
> >
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: gadget: f_uac1_legacy: fix inverted NULL check after kstrndup()
2026-07-09 6:48 ` Greg KH
@ 2026-07-10 12:58 ` Greg KH
0 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2026-07-10 12:58 UTC (permalink / raw)
To: Xu Yang
Cc: Frank Li, kees, christophe.jaillet, xu.yang_2, hataegu0826, balbi,
andrzej.p, linux-usb, linux-kernel, imx
On Thu, Jul 09, 2026 at 08:48:08AM +0200, Greg KH wrote:
> On Thu, Jul 09, 2026 at 02:23:51PM +0800, Xu Yang wrote:
> > On Thu, Jul 09, 2026 at 07:33:03AM +0200, Greg KH wrote:
> > > On Wed, Jul 08, 2026 at 03:54:03PM -0500, Frank Li wrote:
> > > > On Wed, Jul 08, 2026 at 05:05:03PM +0200, Greg KH wrote:
> > > > > On Thu, Jun 25, 2026 at 07:31:54PM +0800, Xu Yang wrote:
> > > > > > From: Xu Yang <xu.yang_2@nxp.com>
> > > > > >
> > > > > > kstrndup() returns NULL on allocation failure. The condition was
> > > > > > checking 'if (tmp)' to detect failure, but this is inverted — it
> > > > > > would treat a successful allocation as an error and return -ENOMEM
> > > > > > while leaking the string, and proceed with a NULL pointer on failure.
> > > > > >
> > > > > > Fix by changing the condition to 'if (!tmp)'.
> > > > > >
> > > > > > Fixes: 0854611a19ae ("usb: gadget: f_uac1: add configfs support")
> > > > > > Cc: stable@vger.kernel.org
> > > > > > Assisted-by: Claude:claude-sonnet-4-6
> > > > > > Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> > > > > > ---
> > > > > > drivers/usb/gadget/function/f_uac1_legacy.c | 2 +-
> > > > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/drivers/usb/gadget/function/f_uac1_legacy.c b/drivers/usb/gadget/function/f_uac1_legacy.c
> > > > > > index 5d201a2e30e7..e9f2632ce785 100644
> > > > > > --- a/drivers/usb/gadget/function/f_uac1_legacy.c
> > > > > > +++ b/drivers/usb/gadget/function/f_uac1_legacy.c
> > > > > > @@ -914,7 +914,7 @@ static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \
> > > > > > goto end; \
> > > > > > \
> > > > > > tmp = kstrndup(page, len, GFP_KERNEL); \
> > > > > > - if (tmp) { \
> > > > > > + if (!tmp) { \
> > > > > > ret = -ENOMEM; \
> > > > > > goto end; \
> > > > > > } \
> > > > > > --
> > > > > > 2.34.1
> > > > > >
> > > > > >
> > > > >
> > > > > So this has never worked? How has no one ever noticed that in the
> > > > > decade this has been in the kernel? Does that mean that no one uses
> > > > > this file/driver and we can just remove it?
> > > >
> > > > I think just no one use sys interface to change name.
> > >
> > > So it can just be removed? Please submit a patch to do that instead.
> > >
> > > Ideally this whole file can be removed, does anyone still use it?
> >
> > This legacy driver is still built in kernel in multi_v7_defconfig:
> >
> > ~/work/usb$ grep -nr CONFIG_USB_CONFIGFS_F_UAC1_LEGACY arch/*/configs/
> > arch/arm/configs/multi_v7_defconfig:939:CONFIG_USB_CONFIGFS_F_UAC1_LEGACY=y
>
> defconfig doesn't mean much. Perhaps look at some of the Android
> configs?
>
> > It seems we can't simply remove it.
>
> Why?
>
> > BTW, do we have other ways to figure out if it can be removed?
>
> Remove it and see who complains? :)
Seriously, let's remove the ability to set the name as that has never
worked. If anyone wants it to work, they can make a new patch to add
that feature as a new one.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-07-10 12:58 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-25 11:31 [PATCH] usb: gadget: f_uac1_legacy: fix inverted NULL check after kstrndup() Xu Yang
2026-06-25 12:15 ` Frank Li
2026-07-08 15:05 ` Greg KH
2026-07-08 20:54 ` Frank Li
2026-07-09 5:33 ` Greg KH
2026-07-09 6:23 ` Xu Yang
2026-07-09 6:48 ` Greg KH
2026-07-10 12:58 ` Greg KH
2026-07-09 16:39 ` David Laight
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox