]> exis.tech > repos - linux.git/commitdiff
usb: cdnsp: fix stream context array leak in cdnsp_alloc_stream_info()
authorHaoxiang Li <haoxiang_li2024@163.com>
Mon, 22 Jun 2026 05:26:27 +0000 (13:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jun 2026 14:12:15 +0000 (15:12 +0100)
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 <stable@kernel.org>
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
Acked-by: Peter Chen <peter.chen@kernel.org>
Link: https://patch.msgid.link/20260622052627.696373-1-haoxiang_li2024@163.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/cdns3/cdnsp-mem.c

index 5d8cdc91927dd5fb88a040c9ba7bdff5940ced9f..83f3384b735dfb345dfbc1e99dd7b32e7a4bdeb2 100644 (file)
@@ -631,6 +631,8 @@ cleanup_rings:
                }
        }
 
+       cdnsp_free_stream_ctx(pdev, pep);
+
 cleanup_stream_rings:
        kfree(pep->stream_info.stream_rings);