From: Takashi Iwai <tiwai@suse.de>
To: Ivy Lopez <skunkolee@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Takashi Iwai <tiwai@suse.de>, Kees Cook <kees@kernel.org>,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
syzbot+2280f1cca5e6b0c353e4@syzkaller.appspotmail.com
Subject: Re: [PATCH] usb: gadget: f_midi2: fix use-after-free in string attribute show path
Date: Sun, 16 Aug 2026 12:40:13 +0200 [thread overview]
Message-ID: <87zeymcprm.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260816005434.34018-1-skunkolee@gmail.com>
On Sun, 16 Aug 2026 02:54:33 +0200,
Ivy Lopez wrote:
>
> f_midi2_opts_str_show() takes the string lock internally, but its
> callers dereference the opts->info.<field> pointer before calling it,
> outside the lock. This races with f_midi2_opts_str_store(), which
> frees the old string under opts->lock when the attribute is written
> concurrently, the show path can read a pointer that gets freed
> before the lock inside str_show() is even taken.
>
> Change f_midi2_opts_str_show() to take a pointer to the string field,
> matching the existing pattern in f_midi2_opts_str_store(), and
> dereference it only after the lock is held. Update all three callers
> (iface_name, block name, and the EP string option macro) accordingly.
>
> Reported-by: syzbot+2280f1cca5e6b0c353e4@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=2280f1cca5e6b0c353e4
> Signed-off-by: Ivy Lopez <skunkolee@gmail.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
thanks,
Takashi
prev parent reply other threads:[~2026-08-16 10:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-16 0:54 [PATCH] usb: gadget: f_midi2: fix use-after-free in string attribute show path Ivy Lopez
2026-08-16 10:40 ` Takashi Iwai [this message]
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=87zeymcprm.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=christophe.jaillet@wanadoo.fr \
--cc=gregkh@linuxfoundation.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=skunkolee@gmail.com \
--cc=syzbot+2280f1cca5e6b0c353e4@syzkaller.appspotmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox