From: Mathias Nyman Date: Thu, 30 Mar 2023 14:30:56 +0000 (+0300) Subject: xhci: Free the command allocated for setting LPM if we return early X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=745dbe21daf7e9c84655101d87ff118fb3ad057e;p=users%2Fjedix%2Flinux-maple.git xhci: Free the command allocated for setting LPM if we return early commit f6caea4855553a8b99ba3ec23ecdb5ed8262f26c upstream. The command allocated to set exit latency LPM values need to be freed in case the command is never queued. This would be the case if there is no change in exit latency values, or device is missing. Reported-by: Mirsad Goran Todorovac Link: https://lore.kernel.org/linux-usb/24263902-c9b3-ce29-237b-1c3d6918f4fe@alu.unizg.hr Tested-by: Mirsad Goran Todorovac Fixes: 5c2a380a5aa8 ("xhci: Allocate separate command structures for each LPM command") Cc: Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20230330143056.1390020-4-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 2b280beb00115..af42abb6db58b 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -4406,6 +4406,7 @@ static int __maybe_unused xhci_change_max_exit_latency(struct xhci_hcd *xhci, if (!virt_dev || max_exit_latency == virt_dev->current_mel) { spin_unlock_irqrestore(&xhci->lock, flags); + xhci_free_command(xhci, command); return 0; }