From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: gregkh@linuxfoundation.org,
ubuntu-devel-discuss@lists.ubuntu.com, stern@rowland.harvard.edu,
arnd@arndb.de, Stable@vger.kernel.org
Subject: Re: [PATCH] xhci: Free the command allocated for setting LPM if we return early
Date: Tue, 28 Mar 2023 10:57:25 +0300 [thread overview]
Message-ID: <46a9abc1-6121-032f-4416-261af73ac05c@linux.intel.com> (raw)
In-Reply-To: <d84fe574-e6cc-ad77-a44c-1eb8df3f2b6b@alu.unizg.hr>
On 28.3.2023 1.25, Mirsad Goran Todorovac wrote:
> On 27. 03. 2023. 11:50, Mathias Nyman wrote:
>> 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.
>>
>> 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;
>> }
>>
>
> After more testing, I can confirm that your patch fixes the leak in the original
> environment.
Thanks for testing.
Can I add the tags below to the patch?
Reported-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
Tested-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
Thanks
Mathias
next prev parent reply other threads:[~2023-03-28 7:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-25 11:27 BUG: drivers/usb/host/xhci: memleak in alloc from xhci_disable_usb3_lpm_timeout() Mirsad Goran Todorovac
2023-03-25 11:33 ` Mirsad Goran Todorovac
2023-03-27 9:41 ` Mathias Nyman
2023-03-27 9:50 ` [PATCH] xhci: Free the command allocated for setting LPM if we return early Mathias Nyman
2023-03-27 11:51 ` Greg KH
2023-03-27 13:31 ` Mathias Nyman
2023-03-27 15:46 ` Mirsad Goran Todorovac
2023-03-27 22:25 ` Mirsad Goran Todorovac
2023-03-28 7:57 ` Mathias Nyman [this message]
2023-04-03 9:20 ` Mirsad Goran Todorovac
2023-03-27 12:04 ` BUG: drivers/usb/host/xhci: memleak in alloc from xhci_disable_usb3_lpm_timeout() Mirsad Goran Todorovac
2023-03-27 22:07 ` BUG: BISECTED: " 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=46a9abc1-6121-032f-4416-261af73ac05c@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=Stable@vger.kernel.org \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mirsad.todorovac@alu.unizg.hr \
--cc=stern@rowland.harvard.edu \
--cc=ubuntu-devel-discuss@lists.ubuntu.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox