From: syzbot <syzbot+2532c7901f590afd0c3a@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: [PATCH] Fix invalid-free in f_uac1_opts_c_srate_store
Date: Sun, 02 Aug 2026 05:54:48 -0700 [thread overview]
Message-ID: <6a6f3e18.13bfb6d0.1ecdd5.026c.GAE@google.com> (raw)
In-Reply-To: <6a6ebd9e.2d659fcc.1d46f5.01cc.GAE@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: [PATCH] Fix invalid-free in f_uac1_opts_c_srate_store
Author: subasris1210@gmail.com
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git 5d5fd841c34649f1b09220fe58e59dffd61c447d
Signed-off-by: Subasri S <subasris1210@gmail.com>
---
drivers/usb/gadget/function/f_uac1.c | 4 +++-
drivers/usb/gadget/function/f_uac2.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c
index 85c502e98f57..488c59fdb2bf 100644
--- a/drivers/usb/gadget/function/f_uac1.c
+++ b/drivers/usb/gadget/function/f_uac1.c
@@ -1595,6 +1595,7 @@ static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \
{ \
struct f_uac1_opts *opts = to_f_uac1_opts(item); \
char *split_page = NULL; \
+ char *original_split_page = NULL; \
int ret = -EINVAL; \
char *token; \
u32 num; \
@@ -1609,6 +1610,7 @@ static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \
i = 0; \
memset(opts->name##s, 0x00, sizeof(opts->name##s)); \
split_page = kstrdup(page, GFP_KERNEL); \
+ original_split_page = split_page; \
while ((token = strsep(&split_page, ",")) != NULL) { \
ret = kstrtou32(token, 0, &num); \
if (ret) \
@@ -1619,7 +1621,7 @@ static ssize_t f_uac1_opts_##name##_store(struct config_item *item, \
}; \
\
end: \
- kfree(split_page); \
+ kfree(original_split_page); \
mutex_unlock(&opts->lock); \
return ret; \
} \
diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
index 897787d0803c..a0b52c262ad8 100644
--- a/drivers/usb/gadget/function/f_uac2.c
+++ b/drivers/usb/gadget/function/f_uac2.c
@@ -2013,6 +2013,7 @@ static ssize_t f_uac2_opts_##name##_store(struct config_item *item, \
{ \
struct f_uac2_opts *opts = to_f_uac2_opts(item); \
char *split_page = NULL; \
+ char *original_split_page = NULL; \
int ret = -EINVAL; \
char *token; \
u32 num; \
@@ -2027,6 +2028,7 @@ static ssize_t f_uac2_opts_##name##_store(struct config_item *item, \
i = 0; \
memset(opts->name##s, 0x00, sizeof(opts->name##s)); \
split_page = kstrdup(page, GFP_KERNEL); \
+ original_split_page = split_page; \
while ((token = strsep(&split_page, ",")) != NULL) { \
ret = kstrtou32(token, 0, &num); \
if (ret) \
@@ -2037,7 +2039,7 @@ static ssize_t f_uac2_opts_##name##_store(struct config_item *item, \
}; \
\
end: \
- kfree(split_page); \
+ kfree(original_split_page); \
mutex_unlock(&opts->lock); \
return ret; \
} \
--
2.43.0
next prev parent reply other threads:[~2026-08-02 12:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-02 3:46 [syzbot] [usb?] KASAN: invalid-free in f_uac1_opts_c_srate_store syzbot
2026-08-02 12:54 ` syzbot [this message]
2026-08-02 13:27 ` Forwarded: [PATCH] Fix " syzbot
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=6a6f3e18.13bfb6d0.1ecdd5.026c.GAE@google.com \
--to=syzbot+2532c7901f590afd0c3a@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.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 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.