From: Takashi Iwai <tiwai@suse.de>
To: raoxu <raoxu@uniontech.com>
Cc: perex@perex.cz, tiwai@suse.com, kees@kernel.org,
mathias.nyman@linux.intel.com, gregkh@linuxfoundation.org,
harshit.m.mogalapalli@oracle.com,
daniel.lezcano@oss.qualcomm.com, karanja99erick@gmail.com,
cassiogabrielcontato@gmail.com, guanyulin@google.com,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: usb-audio: qcom: Free sideband sg_table objects
Date: Wed, 17 Jun 2026 11:05:34 +0200 [thread overview]
Message-ID: <87pl1ppme9.wl-tiwai@suse.de> (raw)
In-Reply-To: <90B353283AA150C4+20260616115916.1222915-1-raoxu@uniontech.com>
On Tue, 16 Jun 2026 13:59:16 +0200,
raoxu wrote:
>
> From: Xu Rao <raoxu@uniontech.com>
>
> The Qualcomm USB audio offload driver obtains an endpoint transfer-ring
> table by calling xhci_sideband_get_endpoint_buffer(). This getter passes
> the endpoint ring to xhci_ring_to_sgtable(), which allocates the outer
> struct sg_table with kzalloc_obj(*sgt). The event-ring path is
> equivalent: xhci_sideband_get_event_buffer() also returns the result of
> xhci_ring_to_sgtable().
>
> Inside xhci_ring_to_sgtable(), sg_alloc_table_from_pages() separately
> allocates the scatterlist storage referenced by sgt->sgl. The returned
> object therefore has two allocation layers: the outer struct sg_table
> and its internal scatterlist storage.
>
> The Qualcomm caller only invokes sg_free_table(sgt). sg_free_table()
> releases the scatterlist storage owned by the table, but it does not
> free the separately allocated outer struct sg_table. The local sgt
> pointer is then discarded, so every successful endpoint or event-ring
> query leaks the outer object.
>
> Call kfree(sgt) after sg_free_table(sgt) in both setup paths, after the
> required page and DMA addresses have been copied out.
>
> Fixes: 326bbc348298 ("ALSA: usb-audio: qcom: Introduce QC USB SND offloading support")
> Signed-off-by: Xu Rao <raoxu@uniontech.com>
Applied now. Thanks.
Takashi
prev parent reply other threads:[~2026-06-17 9:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 11:59 [PATCH] ALSA: usb-audio: qcom: Free sideband sg_table objects raoxu
2026-06-17 9:05 ` 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=87pl1ppme9.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=cassiogabrielcontato@gmail.com \
--cc=daniel.lezcano@oss.qualcomm.com \
--cc=gregkh@linuxfoundation.org \
--cc=guanyulin@google.com \
--cc=harshit.m.mogalapalli@oracle.com \
--cc=karanja99erick@gmail.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=perex@perex.cz \
--cc=raoxu@uniontech.com \
--cc=tiwai@suse.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