Linux USB
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@kernel.org>
To: Haoxiang Li <haoxiang_li2024@163.com>
Cc: pawell@cadence.com, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] usb: cdnsp: fix stream context array leak in cdnsp_alloc_stream_info()
Date: Mon, 22 Jun 2026 18:46:45 +0800	[thread overview]
Message-ID: <ajkSlRv6e2ck5aEE@QCOM-gEdNzOMOFu.na.qualcomm.com> (raw)
In-Reply-To: <20260622052627.696373-1-haoxiang_li2024@163.com>

On 26-06-22 13:26:27, Haoxiang Li wrote:
> cdnsp_alloc_stream_info() allocates stream_info->stream_ctx_array with
> cdnsp_alloc_stream_ctx(). If a later stream ring allocation or stream
> mapping update fails, the error path frees the allocated stream rings
> and stream_rings array, but leaves stream_ctx_array allocated.
> 
> Free the stream context array before falling through to the stream_rings
> cleanup path.
> 
> Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>

Acked-by: Peter Chen <peter.chen@kernel.org>

Peter
> ---
>  drivers/usb/cdns3/cdnsp-mem.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/cdns3/cdnsp-mem.c b/drivers/usb/cdns3/cdnsp-mem.c
> index a2a1b21f2ef8..880097f1007d 100644
> --- a/drivers/usb/cdns3/cdnsp-mem.c
> +++ b/drivers/usb/cdns3/cdnsp-mem.c
> @@ -631,6 +631,8 @@ int cdnsp_alloc_stream_info(struct cdnsp_device *pdev,
>  		}
>  	}
>  
> +	cdnsp_free_stream_ctx(pdev, pep);
> +
>  cleanup_stream_rings:
>  	kfree(pep->stream_info.stream_rings);
>  
> -- 
> 2.25.1
> 
> 

-- 

Thanks,
Peter Chen

      reply	other threads:[~2026-06-22 10:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-22  5:26 [PATCH] usb: cdnsp: fix stream context array leak in cdnsp_alloc_stream_info() Haoxiang Li
2026-06-22 10:46 ` Peter Chen [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=ajkSlRv6e2ck5aEE@QCOM-gEdNzOMOFu.na.qualcomm.com \
    --to=peter.chen@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=haoxiang_li2024@163.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pawell@cadence.com \
    --cc=stable@vger.kernel.org \
    /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