From patchwork Thu Aug 19 20:49:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 12448001 X-Patchwork-Delegate: nbd@nbd.name Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50C63C432BE for ; Thu, 19 Aug 2021 20:50:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 31595610A0 for ; Thu, 19 Aug 2021 20:50:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235605AbhHSUus (ORCPT ); Thu, 19 Aug 2021 16:50:48 -0400 Received: from dispatch1-us1.ppe-hosted.com ([67.231.154.164]:37524 "EHLO dispatch1-us1.ppe-hosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235669AbhHSUur (ORCPT ); Thu, 19 Aug 2021 16:50:47 -0400 X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.110.51.167]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id C1AF9A0073 for ; Thu, 19 Aug 2021 20:50:09 +0000 (UTC) Received: from mail3.candelatech.com (mail2.candelatech.com [208.74.158.173]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 95E02240069 for ; Thu, 19 Aug 2021 20:50:09 +0000 (UTC) Received: from ben-dt4.candelatech.com (50-251-239-81-static.hfc.comcastbusiness.net [50.251.239.81]) by mail3.candelatech.com (Postfix) with ESMTP id 7CCC613C2B3; Thu, 19 Aug 2021 13:49:55 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com 7CCC613C2B3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1629406195; bh=KppOMUbNWFVwiVZmMA7VJzVyk5Br8QdOQVIDyRBVy/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rB/GK6pqniUPyXamdJVVqyPqbWUWlsV5hyMUh4yuhh8VvPRpfxMb/VvQd0Aef6a4/ eUKdP7Jfvnu8FfDosF16T5yY4lJK0/eWu0ofVgJLAwryDxDr2SaZ1aWZ2KS7r1v2TK 6h/tyjDIwFqh4eQyJ0Gw0ChvQrRvQd4pcPK4/7ek= From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: Ben Greear Subject: [PATCH v8 2/9] mt76: mt7915: fix potential NPE in TXS processing Date: Thu, 19 Aug 2021 13:49:43 -0700 Message-Id: <20210819204950.12150-2-greearb@candelatech.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210819204950.12150-1-greearb@candelatech.com> References: <20210819204950.12150-1-greearb@candelatech.com> MIME-Version: 1.0 X-MDID: 1629406210-nzjLHkHJRsHE Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ben Greear If skb is null, then don't try to dereference it. Signed-off-by: Ben Greear --- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index c8432054a63e..05c80a8dd82a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -1320,7 +1320,7 @@ mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid, skb = mt76_tx_status_skb_get(mdev, wcid, pid, &list); if (!skb) - goto out; + goto out_no_skb; txs = le32_to_cpu(txs_data[0]); @@ -1423,6 +1423,8 @@ mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid, out: mt76_tx_status_skb_done(mdev, skb, &list, wcid); + +out_no_skb: mt76_tx_status_unlock(mdev, &list); return !!skb;