Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1365607rwb; Fri, 7 Oct 2022 11:30:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6/9y84MMiJS6kZjn1/ofX126hUK6NV7VZgoiHpqkMsQvsvXFwD7QfQGfXmz+lVXGL4Gggv X-Received: by 2002:a17:906:9be9:b0:78d:2f63:10dd with SMTP id de41-20020a1709069be900b0078d2f6310ddmr5137211ejc.479.1665167452250; Fri, 07 Oct 2022 11:30:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665167452; cv=none; d=google.com; s=arc-20160816; b=uILdIAZltFvsH19REoufcFJy82FAT3YSiZT+nuVQgn2pvzBJ61UsXUmid3aOvxUeSy sRR09gaX86qTUumsVCumBXNlVXBK9lLiFakxSIQbPXAIy13CHSDqP3cHBMegogUgEbQn 3AcGgD6p8jZ/jwZ7W6jm2r9J5Oyaxdko7t9ZmDgNmmeRQCCagHJBRWNYybYTx3pkXKIE m+qPKi0zrO8MY2vO/7wIPv2cKPWnJo9FfehEOEsVS8wxY9Pk2bjlS4yNYaJWatBsBnE4 0/LfAbSa0L+SkYwgkQNhgLM1fbYt39cTwGQssOucCN+Ib+Vg6bPHmOriaIDpGr2EXaGe CJaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :from; bh=1yO3exAMwv1y1zHEN85+kNkgbL2K5cdBLW0UF5GZsE0=; b=HHrA6YoZnRtevc8VMKpiFD5saK6yCRDlYWqymPXkp10SJxDI4nsDYWmwFT4jhLPguM bserZI2MSbu1OZwvBkGrGpUf4Sw1zsJOCFEmf2sh3gA8axvgMyvwKaiT1Mkh3iwzAJLA B57nYBbpDjGx3gZbQtoY8Ae/adNpzVMVPRx3r++GFGPZStfchNrPF/AJALiGug+B2Ymm e5JIKkVoVW9nmQv6wTweLE4P1isTd/8NOy7PZfHwtum/wFgAzjhtbPInrQzdCSJylTF6 spYH5PcB2uuhjpOFB0J5jAqeKB3t3TFupQdPQ7JdwlnXpd2cohLp/UAqShETAJ7/oEbv b/4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toke.dk header.s=20161023 header.b=UOaUNb8l; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=toke.dk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa38-20020a1709076d2600b007799e328e10si3116335ejc.999.2022.10.07.11.30.33; Fri, 07 Oct 2022 11:30:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@toke.dk header.s=20161023 header.b=UOaUNb8l; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=toke.dk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229778AbiJGSWT (ORCPT + 61 others); Fri, 7 Oct 2022 14:22:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229763AbiJGSWS (ORCPT ); Fri, 7 Oct 2022 14:22:18 -0400 Received: from mail.toke.dk (mail.toke.dk [IPv6:2a0c:4d80:42:2001::664]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14552C0680; Fri, 7 Oct 2022 11:22:13 -0700 (PDT) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=20161023; t=1665166931; bh=1yO3exAMwv1y1zHEN85+kNkgbL2K5cdBLW0UF5GZsE0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=UOaUNb8l+xPl1i2ImLsV4Awx4Qqd6teobZXrn2Hcn6POxqE8+RwtGaU9xMqwJrBfv +DL/Hzo0mwHsd7MP1FH1LPDbR75C1XaUQiELp/eeeSMQBT2j+mtYjuZMkMHeExL9IF YYJurUKLPVgwyxsLl2GdZbS4awDOx+EpavhwTbLWbymawoD/0G4+mr4t06Ypj0sPsl 9OB7N69oqLKSy6hnrJdH4rpzH3QlOQnNbi+DXIqLoSY/sW6/kT5co89+r4vJbb7yH7 SzosSUrl1jNiVlwEsczXAax4G4Gan3tOkZevY4tnlB29dzZjVX7sjdrR8uN40TXKsH 8j42Rnlg86uQg== To: Fedor Pchelkin , Kalle Valo Cc: Fedor Pchelkin , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Brooke Basile , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Alexey Khoroshilov Subject: Re: [PATCH] ath9k: hif_usb: fix memory leak of urbs in ath9k_hif_usb_dealloc_tx_urbs() In-Reply-To: <20220725151359.283704-1-pchelkin@ispras.ru> References: <20220725151359.283704-1-pchelkin@ispras.ru> Date: Fri, 07 Oct 2022 20:22:11 +0200 X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <871qrjtrxo.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Fedor Pchelkin writes: > Syzkaller reports a long-known leak of urbs in > ath9k_hif_usb_dealloc_tx_urbs(). > > The cause of the leak is that usb_get_urb() is called but usb_free_urb() > (or usb_put_urb()) is not called inside usb_kill_urb() as urb->dev or > urb->ep fields have not been initialized and usb_kill_urb() returns > immediately. > > The patch removes trying to kill urbs located in hif_dev->tx.tx_buf > because hif_dev->tx.tx_buf is not supposed to contain urbs which are in > pending state (the pending urbs are stored in hif_dev->tx.tx_pending). > The tx.tx_lock is acquired so there should not be any changes in the list. > > Found by Linux Verification Center (linuxtesting.org) with Syzkaller. > > Fixes: 03fb92a432ea ("ath9k: hif_usb: fix race condition between usb_get_= urb() and usb_kill_anchored_urbs()") > Signed-off-by: Fedor Pchelkin > Signed-off-by: Alexey Khoroshilov Acked-by: Toke H=C3=B8iland-J=C3=B8rgensen