Skip to content

Commit c00826e

Browse files
Haoxiang Ligregkh
authored andcommitted
usb: cdnsp: fix stream context array leak in cdnsp_alloc_stream_info()
commit 3348f44 upstream. 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: 3d82904 ("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>
1 parent e22f044 commit c00826e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/usb/cdns3/cdnsp-mem.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,8 @@ int cdnsp_alloc_stream_info(struct cdnsp_device *pdev,
632632
}
633633
}
634634

635+
cdnsp_free_stream_ctx(pdev, pep);
636+
635637
cleanup_stream_rings:
636638
kfree(pep->stream_info.stream_rings);
637639

0 commit comments

Comments
 (0)