Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp4421287pxy; Tue, 27 Apr 2021 04:51:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAv3G//ghT0zLTXZ/C4SQvc5wNKdF4+ZZCEdHhzX+xaOzfKA3TcYiW/4bMoKJA2u6hA/Av X-Received: by 2002:a05:6402:4390:: with SMTP id o16mr3800275edc.14.1619524302902; Tue, 27 Apr 2021 04:51:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619524302; cv=none; d=google.com; s=arc-20160816; b=B7g/jjqkQHZwh1r4gqHahT7PJA0WH4DWfgxs6GBV7iz0js6288XfqPX9ryY3RGeYq0 kXXlv9YRMOXSvTmarCCXz0PX+1coYeOQ2gJQRu1DBPMF/E0joAFrx+eEy2soDlohYHfD fXvccjJ/mIqvcUv7dpRQYdMPJ8uY0v++JG2GaznhaHj35ihJL4L83Kp92Uur6tcps+zs rM8f3+QJY1UTCI4BmJRR1u3btHLBJFNbv5tMR51ISYPrCrCsHsZ81D3pnStjvB+tTb8x Gk7haPHQDAYF0RbwZmceXfRg1BfTfFuXV5pD6sCuXwlKromWIqO+L5mJBScDfEIHZ3zv BQrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Z3hGvixAt6hfYm6pOEzL4N7bpBjG7S3p2F5dfpLWgHQ=; b=uwhWJO3bWJF7Uguu4XwQt9FvRmdGQJFOMd7v7gVBdqnnTCCup6zG4j62Lkp2s5TaF3 1Emu2/G7paEDct+bV8vsTc1PAviDVE6MFpEm87Jmm5bcmEfExfSAzYyOt3ri4AdXiUb9 Li2FvOih86LLPCLPHxPXcixoD4w5UFQcL2PGrEBfIm7l2Ylvsom+sbbGeZhUNv64/62k TuMTtHnTFiWd1+vfXR2S3TAKkrkPPCvssJpsWJy6Qif+IIxUkDV3E+CldNMODhkXirv1 CnQUNXK/GsNNY9n+Jr9tIfIFU/HwrxlrYxm7vwgtQX1KN4NBsSN3PMR/u4HEfUikqxiD 2Ubw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="N/wRLXoC"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v13si2387039edl.526.2021.04.27.04.51.12; Tue, 27 Apr 2021 04:51:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="N/wRLXoC"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237505AbhD0Lvj (ORCPT + 99 others); Tue, 27 Apr 2021 07:51:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:56776 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235570AbhD0Lvi (ORCPT ); Tue, 27 Apr 2021 07:51:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 94B9A613E5; Tue, 27 Apr 2021 11:50:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619524255; bh=U+XMIP+ThaYX6azhRBFTHR13AT1gGRFQ8ZDW2B48MJI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=N/wRLXoClzo3qTvcMHewSEIrGQr7NG/if7bhHb8o4GGetGh2TvGm5XEx9UAEZWmvy isigkikmRYe8iCbrFNBxamfWLOg8czXlqHYNMoBMeT6DHLVnf89OGogDWyHon2FON4 Ib2bSfnYx+A7IsKm8BWREAdq2/EjzRHjzjqlSKVM= Date: Tue, 27 Apr 2021 13:50:53 +0200 From: Greg KH To: Atul Gopinathan Cc: Pavel Skripkin , brookebasile@gmail.com, ath9k-devel@qca.qualcomm.com, davem@davemloft.net, kuba@kernel.org, kvalo@codeaurora.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, syzbot+89bd486af9427a9fc605@syzkaller.appspotmail.com, syzkaller-bugs@googlegroups.com Subject: Re: Memory leak in ath9k_hif_usb_dealloc_tx_urbs() Message-ID: References: <20200911071427.32354-1-brookebasile@gmail.com> <20210330193652.10642-1-paskripkin@gmail.com> <20210427113559.GA7527@atulu-nitro> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210427113559.GA7527@atulu-nitro> Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Tue, Apr 27, 2021 at 05:05:59PM +0530, Atul Gopinathan wrote: > On Wed, Mar 31, 2021 at 08:28:15AM +0200, Greg KH wrote: > > 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 :) > > Just wanted to confirm, what is the status of this bug then, as in is it > invalid (not sure if that's the correct word)? I happened to stumble > across the same syzkaller bug report Pavel posted above, in the morning. > Saw that there has been no patch tests/fixes on this yet according to > syzkaller. Spent a couple of hours going through it before sending a > test patch to syzbot which returned an "OK" (and the patch is exactly > what Pavel pointed out, I simply removed the `usb_get_urb()`). Before > sending anything to the mailing list, I made sure to search all the > relavant networking lists to see if this topic had been brought up (learnt > to do this from my preious mistakes of sending already accepted patches) and > luckily I found this. > > Syzbot has had 380 crashes caused by this bug, with the latest being > today. So I wanted to confirm what should be done be about this bug. If you think you can fix it, wonderful, go ahead please! greg k-h