Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4495500rwb; Mon, 8 Aug 2022 01:50:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR4kz3SqOt7LLOt41aSwPMR1xg8zZaB64C1JjdJ6UUi5mvOAyge3brJ4Wo99iOC9iHCu5yJJ X-Received: by 2002:a05:6402:2683:b0:43e:76fc:f9db with SMTP id w3-20020a056402268300b0043e76fcf9dbmr16430444edd.390.1659948613397; Mon, 08 Aug 2022 01:50:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659948613; cv=none; d=google.com; s=arc-20160816; b=LVs1EMVpio8NYBxEm3upJW4Cqdsv45OoNR6fqBb3PNtJXOhNdvnN46iQdpUzeu8A/n L6aRGApLKamS9XV1rLjJeeRbuCzbQ+p2/6V1cb7ZRYi0EpxauW/eC/vkN/G0FM9RN3XI kOPamU4X/mXg7z66o1CNAb61inGeyUT/rQDQhFmtHwT/ttNKsKmhIdPCyyPdB0r5Sobb kQkmvP4GN6Y+cQxdoBg88k0FRNXvFUa5eq+0ZPgIS/BRFXwqzRo5LJwciHSommc7hieG nG4mc4TIiCw/z1ni/OZfCg8xKYByRbm86/Q+Zt+h5cTwBrp5TLr5jMzeATahsY8o3/Ay QSJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=/V5YRzrrngmrKnPlwjf2mgGczmcX1pFkUBvlD3ol0Bc=; b=MrDI73AYTcj69mrdDXBTxsoPEYBxgV5rECoH2eotJ0Htvytl0mRVGUje2+p08d4jXq bl+y6hauXUfFwymvE7YUoT7eBgx+N7cFESrDVMzdp2l9MgCEbakvx3hU5PfTKhkLuzf+ RG72iiwCN4gRdVBZrdZZUOW3ltYTmTl0ywg4MNWl+QcUaejsZOkDByQtWPOohywqA33s N/l/rD6SYtrOeQNajVGhkIjuRN7ssG6d2t7t+P8uskYoqu+DIJkfO7zK1xMVXKjuYJpx 7L12qSlV5wNZRzL6Vgl4irJAqEbfl5u6cuZgzJeoxeYknN78THgs2+zyJE2xORjk3Moy UpeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GQnd9TY1; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds4-20020a170907724400b007313c16ec8fsi4564978ejc.114.2022.08.08.01.49.48; Mon, 08 Aug 2022 01:50:13 -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=@gmail.com header.s=20210112 header.b=GQnd9TY1; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236257AbiHHImr (ORCPT + 66 others); Mon, 8 Aug 2022 04:42:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236156AbiHHImo (ORCPT ); Mon, 8 Aug 2022 04:42:44 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D66D462DB for ; Mon, 8 Aug 2022 01:42:43 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id q7-20020a17090a7a8700b001f300db8677so8392396pjf.5 for ; Mon, 08 Aug 2022 01:42:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=/V5YRzrrngmrKnPlwjf2mgGczmcX1pFkUBvlD3ol0Bc=; b=GQnd9TY1YEzi5kl2Lpj5+BraYFv5K2KMYpqyeBGSJX6Ps2WZx6/vOZrvXXT6BdDe9N rPt38lus/dthOJHWQ/BqlCgrV9PUQAFLO0bjVkVy49GYKCeIg/ghmEoM7hG22+ZfvANO WwHAk1xRJtmZ+unsjz/xoUL1MbP1E10HzG/GWA/wno3uGH1NEDCQQwRxMSNJH+EgSgmY zFHHddStYltjqR+0+DbBy+SPTxX8WuILn6nyRLe2iwjiDwFoTk7tduaNHbnts9iKwAZ0 emjGWfKkTHTGiJZBfHzBxOHiqtu/3BuVbk3xnA6OtC/lHnYDTtKDDRN4sH6QRVwyFwO8 l5Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=/V5YRzrrngmrKnPlwjf2mgGczmcX1pFkUBvlD3ol0Bc=; b=CMPBe7OLCGMAl5xH96rseLZqdJldjrjKIanJqx1ep+jg0B+q2KEveI8DxR152fxXup eZtF0TDVVxAkwDUu0zJmxKpRL7Gv4hL9x3hfQO+Rvg05fdpRDFvCj0nOjTdLqnH+O6T+ gubnl99eJntnu0O2WEwTH+hZRkGvwDIFlon3O3KOvBQvI+Agwl8hFL4mLC21m+eM7dDt MLV3DkxoguYCuuPyd7JC1OZUFOLvrMr1WeOmTB2FdsLB30P/DtRz/k5X1cw5H/ADZflI wUqJOaPwLkBtTIGjHwft5rPym2a8ZUJcqAxDwJwg8POC8k8gljldod8p6OcY634gGj9U e2qA== X-Gm-Message-State: ACgBeo3DRqCiEXZprXUSGo/zE6qhZLgQm8vzteZUtwH6udc1w5bUIeQJ vN0U2yRTr63lttDc+AB4b2M= X-Received: by 2002:a17:902:ecce:b0:16e:e6e9:69b9 with SMTP id a14-20020a170902ecce00b0016ee6e969b9mr17667827plh.139.1659948163208; Mon, 08 Aug 2022 01:42:43 -0700 (PDT) Received: from [10.176.68.61] ([192.19.148.250]) by smtp.gmail.com with ESMTPSA id b4-20020a170902d40400b0016f1319d2aasm7984242ple.171.2022.08.08.01.42.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Aug 2022 01:42:42 -0700 (PDT) Message-ID: Date: Mon, 8 Aug 2022 10:42:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH] brcmfmac: fix use-after-free bug Content-Language: en-US To: Alexander Coffin , Franky Lin , Hante Meuleman Cc: linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, SHA-cyfmac-dev-list@infineon.com References: <20220802172823.1696680-1-alex.coffin@matician.com> <20220802172823.1696680-2-alex.coffin@matician.com> From: Arend Van Spriel In-Reply-To: <20220802172823.1696680-2-alex.coffin@matician.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On 8/2/2022 7:28 PM, Alexander Coffin wrote: > A commit message would have been nice... > Signed-off-by: Alexander Coffin > --- > drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c > index 87aef211b35f..12ee8b7163fd 100644 > --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c > +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c > @@ -296,6 +296,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, > struct brcmf_pub *drvr = ifp->drvr; > struct ethhdr *eh; > int head_delta; > + unsigned int tx_bytes = skb->len; > > brcmf_dbg(DATA, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx); > > @@ -370,7 +371,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, > ndev->stats.tx_dropped++; > } else { > ndev->stats.tx_packets++; > - ndev->stats.tx_bytes += skb->len; > + ndev->stats.tx_bytes += tx_bytes; Why would this be a use-after-free? We only get here when ret is zero. In that case the skb is not freed. If there would be a commit message with some error report that proofs there is a use-after-free I would look into this further, but now I just say NAK. Regards, Arend > } > > /* Return ok: we always eat the packet */