All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: <gregkh@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>,
	Mathias Nyman <mathias.nyman@linux.intel.com>,
	Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>,
	Stable@vger.kernel.org
Subject: [PATCH 3/3] xhci: Free the command allocated for setting LPM if we return early
Date: Thu, 30 Mar 2023 17:30:56 +0300	[thread overview]
Message-ID: <20230330143056.1390020-4-mathias.nyman@linux.intel.com> (raw)
In-Reply-To: <20230330143056.1390020-1-mathias.nyman@linux.intel.com>

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 <mirsad.todorovac@alu.unizg.hr>
Link: https://lore.kernel.org/linux-usb/24263902-c9b3-ce29-237b-1c3d6918f4fe@alu.unizg.hr
Tested-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
Fixes: 5c2a380a5aa8 ("xhci: Allocate separate command structures for each LPM command")
Cc: <Stable@vger.kernel.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
 drivers/usb/host/xhci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index bdb6dd819a3b..6307bae9cddf 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4442,6 +4442,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;
 	}
 
-- 
2.25.1


  parent reply	other threads:[~2023-03-30 14:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30 14:30 [PATCH 0/3] xhci fixes for usb-linus Mathias Nyman
2023-03-30 14:30 ` [PATCH 1/3] xhci: also avoid the XHCI_ZERO_64B_REGS quirk with a passthrough iommu Mathias Nyman
2023-03-30 14:40   ` Greg KH
2023-03-31  7:35     ` Mathias Nyman
2023-03-31  7:40       ` Greg KH
2023-03-30 14:30 ` [PATCH 2/3] Revert "usb: xhci-pci: Set PROBE_PREFER_ASYNCHRONOUS" Mathias Nyman
2023-03-30 14:40   ` Greg KH
2023-03-31  7:29     ` Mathias Nyman
2023-03-30 14:30 ` Mathias Nyman [this message]
2023-04-03  7:17   ` [PATCH 3/3] xhci: Free the command allocated for setting LPM if we return early Mirsad Goran Todorovac
2023-04-03  7:24     ` Greg KH
2023-04-03  7:57       ` Mirsad Goran Todorovac
2023-04-03  8:01         ` Mirsad Goran Todorovac
2023-04-03  8:28           ` Greg KH
2023-04-03  8:36             ` Mirsad Goran Todorovac
2023-04-03 12:33             ` Mirsad Goran Todorovac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230330143056.1390020-4-mathias.nyman@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=Stable@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mirsad.todorovac@alu.unizg.hr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.