xhci: dbc: Fix memory leak in xhci_alloc_dbc()
authorRafael Mendonca <rafaelmendsr@gmail.com>
Wed, 21 Sep 2022 12:34:46 +0000 (15:34 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 10:34:19 +0000 (12:34 +0200)
commit103b459590e1eb4d80b02761eb36c7cae1d9b58e
tree1aa8baba63e648902636c0043f9b5e80232c011b
parent39f4c90b99956e7f7fdf54f0014ba1deaa425cbc
xhci: dbc: Fix memory leak in xhci_alloc_dbc()

commit d591b32e519603524a35b172156db71df9116902 upstream.

If DbC is already in use, then the allocated memory for the xhci_dbc struct
doesn't get freed before returning NULL, which leads to a memleak.

Fixes: 534675942e90 ("xhci: dbc: refactor xhci_dbc_init()")
Cc: stable@vger.kernel.org
Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20220921123450.671459-3-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-dbgcap.c