Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1689850rwi; Mon, 10 Oct 2022 21:44:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5km0187FB4T6zLjEA+gKSySZFbV83Zcyza3qaMazlcyVf9AwqMnAWOTzCKIKrlqyOpoe9m X-Received: by 2002:a17:907:7b9e:b0:78d:cddc:1ba5 with SMTP id ne30-20020a1709077b9e00b0078dcddc1ba5mr3455764ejc.754.1665463446278; Mon, 10 Oct 2022 21:44:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665463446; cv=none; d=google.com; s=arc-20160816; b=tBkOMkpeaqMel/+nINjQXLN43z89lCxpIzpKekxTmu5lsL298mZE86/dyPNgQu15B4 7r+hCr02rjssmFjHGgPnhMj2+21Xy2Q6FB0pFaD8HbWQFO2wV8dGHeH85uwdPvGKRd/b IvgqT0YiJ78a8c0wjwDlz0z9d2CQjGrzAIt2DRcsiColm1kBTiK2VwHb3A7rk28UUVrJ 8V5Sb6Ew+CdxYsb1z4uqncxfKdAu+dBC4eh/70hVXyClio9IsthLRWVtgGM9ymcda/4d M3B5U4I1Y6YqHGG84GCWv2q0o1suUjFU5bnrxsPgecwdkE8UdCUtobQsFRa/yhO/MHVS JozQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:message-id:user-agent:cc:to:references :in-reply-to:from:subject:content-transfer-encoding:mime-version :dkim-signature; bh=trD7XVEA8BS/JiyYajqrM+jeo03a1uOTlZ25+hW9DDY=; b=Lz+RxtPwFZEuOg4Xp5yW8xCItTzQvpNtV4ZbsK39yUEqwu8JoGtO+3oYJnE2k8/am2 ljb3MkWTWOGZHTSXP4bBSiKnslqGBTKUcWgrpRWgCkuXNsceZBq4stk2u3Z7iKWJEHtK hWzDLnbe8nQXiRk4hYQD7kDezYOnWYVxnS6NAF3CrJXhPZU1dqaMv80gbIR0tlVt86Uw LGsbukfEQSTpcptnCZm9MlK0tNraOo9AUipjo7cw7KEGJ6VF+gRJ9s6ZRFphWUii/xvN nrYa3C3V9LQVgO+KE6r9Ko2vNfURSadXNUcpzuddpriqV3v6+EARVAtXKyYCGXhfU5kI CtlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XYtd+pgy; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt6-20020a170907728600b0078168566b26si12166473ejc.356.2022.10.10.21.43.51; Mon, 10 Oct 2022 21:44:06 -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=@kernel.org header.s=k20201202 header.b=XYtd+pgy; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229445AbiJKEkI (ORCPT + 61 others); Tue, 11 Oct 2022 00:40:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbiJKEkH (ORCPT ); Tue, 11 Oct 2022 00:40:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B6AA2229B; Mon, 10 Oct 2022 21:40:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 080B5610A3; Tue, 11 Oct 2022 04:40:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF425C433C1; Tue, 11 Oct 2022 04:40:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665463203; bh=e9KKMgIAQyHBhjea4hfYXUv3pPjTlJgQE4f/Urrev4M=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=XYtd+pgy7yj9aLks14aUZO7hd6jVsPWFetH7s8xxMOMWEb9l16B+/AyJwTKdnEQTc vOZ5Nr2P+bpUsU34Uievayvp7sHkGNlSOehX2J53ieVkmuNIRLOpRU8XA2cSX8E+Y/ fwLhmkl5fbtXb19mRSfzMpUAel3KNFTkA5KJtZYlExPduYSHd9cHzO3Bj06SAedCC5 d6dxMSzYu0IjHtnlhWNNjRkc1a6765LCeoCej3TTHAqeJJtE4ZzUS3vLJ0bfgpqxjo vHIQTEhNMySHkmTTLt2qhEWdQZR3yEOCkgloUmhdU9yn9wkNLWJTzSGLzSPTvcjie1 Y61AIxf0dhbkg== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Re: [PATCH v2] ath9k: hif_usb: Fix use-after-free in ath9k_hif_usb_reg_in_cb() From: Kalle Valo In-Reply-To: <20221008114917.21404-1-pchelkin@ispras.ru> References: <20221008114917.21404-1-pchelkin@ispras.ru> To: Fedor Pchelkin Cc: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , Fedor Pchelkin , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Alexey Khoroshilov , lvc-project@linuxtesting.org User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.7.3 Message-ID: <166546319878.5539.2693721312600090208.kvalo@kernel.org> Date: Tue, 11 Oct 2022 04:40:00 +0000 (UTC) X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 wrote: > It is possible that skb is freed in ath9k_htc_rx_msg(), then > usb_submit_urb() fails and we try to free skb again. It causes > use-after-free bug. Moreover, if alloc_skb() fails, urb->context becomes > NULL but rx_buf is not freed and there can be a memory leak. > > The patch removes unnecessary nskb and makes skb processing more clear: it > is supposed that ath9k_htc_rx_msg() either frees old skb or passes its > managing to another callback function. > > Found by Linux Verification Center (linuxtesting.org) with Syzkaller. > > Fixes: 3deff76095c4 ("ath9k_htc: Increase URB count for REG_IN pipe") > Signed-off-by: Fedor Pchelkin > Signed-off-by: Alexey Khoroshilov > Acked-by: Toke Høiland-Jørgensen > Signed-off-by: Kalle Valo Patch applied to ath-next branch of ath.git, thanks. dd95f2239fc8 wifi: ath9k: hif_usb: Fix use-after-free in ath9k_hif_usb_reg_in_cb() -- https://patchwork.kernel.org/project/linux-wireless/patch/20221008114917.21404-1-pchelkin@ispras.ru/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches