From: sashiko-bot@kernel.org
To: "Tristan Madani" <tristmd@gmail.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v4] usb: gadget: f_uac1_legacy: fix copy_buf lifetime on queue handoff and free
Date: Wed, 04 Nov 2026 13:03:53 +0000 [thread overview]
Message-ID: <sashiko-outbox-197321@kernel.org> (raw)
In-Reply-To: <20261104125346.2552742-1-tristmd@gmail.com>
> From: Tristan Madani <tristan@talencesecurity.com>
>
> f_audio_free() tears down the f_audio structure without cancelling
> playback_work or releasing audio buffers. The pending work can access
> the freed structure, and queued audio buffers leak.
>
> Additionally, f_audio_set_alt() and f_audio_out_ep_complete() transfer
> copy_buf to play_queue without clearing audio->copy_buf. When
> playback_work later consumes the buffer from the queue, audio->copy_buf
> becomes a stale reference.
>
> Clear audio->copy_buf when its buffer is queued to play_queue, so the
> pointer reliably reflects ownership. In f_audio_free(), cancel
> playback_work, drain the play_queue, and free copy_buf when it was not
> queued. Use IS_ERR_OR_NULL for the copy_buf check because
> f_audio_buffer_alloc() returns ERR_PTR on failure and f_audio_set_alt()
> stores the result directly in audio->copy_buf.
>
> Fixes: c6994e6f067c ("USB: gadget: add USB Audio Gadget driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261104125346.2552742-1-tristmd@gmail.com?part=1
next prev parent reply other threads:[~2026-11-04 13:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 12:53 [PATCH v4] usb: gadget: f_uac1_legacy: fix copy_buf lifetime on queue handoff and free Tristan Madani
2026-11-04 13:03 ` sashiko-bot [this message]
2026-11-20 11:16 ` Greg Kroah-Hartman
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=sashiko-outbox-197321@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tristmd@gmail.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.