[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <877dhcgcyh.fsf@codeaurora.org>
Date: Tue, 27 Jul 2021 15:26:14 +0300
From: Kalle Valo <kvalo@...eaurora.org>
To: Julian Calaby <julian.calaby@...il.com>
Cc: Dongliang Mu <mudongliangabcd@...il.com>,
QCA ath9k Development <ath9k-devel@....qualcomm.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Brooke Basile <brookebasile@...il.com>,
syzbot+6692c72009680f7c4eb2@...kaller.appspotmail.com,
linux-wireless <linux-wireless@...r.kernel.org>,
netdev@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ath9k: hif_usb: fix memory leak in ath9k_hif_usb_firmware_cb
Julian Calaby <julian.calaby@...il.com> writes:
> Hi Dongliang,
>
> (Drive-by review, I know almost nothing about the code in question)
>
> On Fri, Jul 9, 2021 at 6:47 PM Dongliang Mu <mudongliangabcd@...il.com> wrote:
>>
>> The commit 03fb92a432ea ("ath9k: hif_usb: fix race condition between
>> usb_get_urb() and usb_kill_anchored_urbs()") adds three usb_get_urb
>> in ath9k_hif_usb_dealloc_tx_urbs and usb_free_urb.
>>
>> Fix this bug by adding corresponding usb_free_urb in
>> ath9k_hif_usb_dealloc_tx_urbs other and hif_usb_stop.
>>
>> Reported-by: syzbot+6692c72009680f7c4eb2@...kaller.appspotmail.com
>> Fixes: 03fb92a432ea ("ath9k: hif_usb: fix race condition between usb_get_urb() and usb_kill_anchored_urbs()")
>> Signed-off-by: Dongliang Mu <mudongliangabcd@...il.com>
>> ---
>> drivers/net/wireless/ath/ath9k/hif_usb.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
>> index 860da13bfb6a..bda91ff3289b 100644
>> --- a/drivers/net/wireless/ath/ath9k/hif_usb.c
>> +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
>> @@ -457,6 +457,7 @@ static void hif_usb_stop(void *hif_handle)
>> usb_kill_urb(tx_buf->urb);
>> list_del(&tx_buf->list);
>> usb_free_urb(tx_buf->urb);
>> + usb_free_urb(tx_buf->urb);
>
> Ok, so if I'm reading this correctly, before the first usb_free_urb()
> call, we have two references to the urb at tx_buf->urb.
>
> Why?
>
> Isn't the better fix here to detangle why there's more than one
> reference to it and resolve it that way? This looks like a hack to fix
> something much more fundamentally broken.
Yeah, this looks very suspicious.
One more thing: also the patch should be tested with real hardware. I'm
worried that people are just trying to fix a syzbot warning and not
really considering how it works in real life. That's why I'm extra
careful with syzbot patches for wireless drivers.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Powered by blists - more mailing lists