lkml.org 
[lkml]   [2021]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Memory leak in ath9k_hif_usb_dealloc_tx_urbs()
On Tue, Mar 30, 2021 at 10:36:52PM +0300, Pavel Skripkin wrote:
> Hi!
>
> I did some debugging on this
> https://syzkaller.appspot.com/bug?id=3ea507fb3c47426497b52bd82b8ef0dd5b6cc7ee
> and, I believe, I recognized the problem. The problem appears in case of
> ath9k_htc_hw_init() fail. In case of this fail all tx_buf->urb krefs will be
> initialized to 1, but in free function:
>
> static void ath9k_hif_usb_dealloc_tx_urbs(struct hif_device_usb *hif_dev)
>
> ....
>
> static void ath9k_hif_usb_dealloc_tx_urbs(struct hif_device_usb *hif_dev)
> {
> ...
> list_for_each_entry_safe(tx_buf, tx_buf_tmp,
> &hif_dev->tx.tx_buf, list) {
> usb_get_urb(tx_buf->urb);
> ...
> usb_free_urb(tx_buf->urb);
> ...
> }
>
> Krefs are incremented and then decremented, that means urbs won't be freed.
> I found your patch and I can't properly understand why You added usb_get_urb(tx_buf->urb).
> Can You explain please, I believe this will help me or somebody to fix this ussue :)

I think almost everyone who has looked into this has given up due to the
mess of twisty-passages here with almost no real-world benefits for
unwinding them :)

Good luck!

greg k-h

\
 
 \ /
  Last update: 2021-03-31 08:29    [W:0.091 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site