Re: [PATCH] usb: xhci: Fix memory leak in xchi_disable_slot()

From: Greg KH

Date: Wed Jan 07 2026 - 10:04:46 EST


On Thu, Dec 25, 2025 at 04:21:19PM +0000, Zilin Guan wrote:
> xhci_alloc_command() allocates a command structure and, when the
> second argument is true, also allocates a completion structure.
> Currently, the error handling path in xhci_disable_slot() only frees
> the command structure using kfree(), causing the completion structure
> to leak.
>
> Fix this by using xhci_free_command() instead of kfree(). This function
> correctly frees both the command and the completion structure.
>
> Fixes: cd3f1790b006d ("usb: xhci: Fix potential memory leak in xhci_disable_slot()")

No cc: stable?

And how was this found? How was it tested? What tool created this fix?

thanks,

greg k-h