From patchwork Tue Apr 27 10:05:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 428343 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=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 44A3EC433B4 for ; Tue, 27 Apr 2021 10:05:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EEFA360FDA for ; Tue, 27 Apr 2021 10:05:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235181AbhD0KFw (ORCPT ); Tue, 27 Apr 2021 06:05:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:55396 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230341AbhD0KFu (ORCPT ); Tue, 27 Apr 2021 06:05:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BC236613C5; Tue, 27 Apr 2021 10:05:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619517905; bh=WccPtnp9AkXba1B2VvgliyQx341WmI3CyGXemNVgsZY=; h=From:To:Cc:Subject:Date:From; b=kd9TP0SiOXohg8kHqWdA9xNiRG5IRXYyQ5vV2apmm49y71Mj14IyPs5j08yIKiLpU PAYoQ4OnthY2Mz5tQ4GVgwX/sRBekhdJdNIK1hhVbpN9JS7pROwmvU3hZq0QnqpTg/ +54uvmtROa4p8XVp3aOOi/Ryb1VZUzFTF19FwU5xb9uSBUzO4tuFM1PIVEU1oLqvig QIzMIGj4lq54UwuZQfO7IxxHiNPHRU68X2hF7OTPl8kL3ESBUYzO/pPCAC8xnNWqy4 jQW+ucURr0JZpS87uttkO3+upAFicNhzLIjntKjN5I9osVrzgh1SiQ8MzEgcuXrnYr EjITgvNO9krOg== From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, lorenzo.bianconi@redhat.com Subject: [PATCH] mt76: fix possible NULL pointer dereference in mt76_tx Date: Tue, 27 Apr 2021 12:05:00 +0200 Message-Id: <6f0d5deedca8e8dd273e7c1ceda256c9ac2f4e3a.1619517788.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Even if this is not a real issue since mt76_tx is never run with wcid set to NULL, fix a theoretical NULL pointer dereference in mt76_tx routine Fixes: db9f11d3433f7 ("mt76: store wcid tx rate info in one u32 reduce locking") Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c index 53ea8de82df0..441d06e30b1a 100644 --- a/drivers/net/wireless/mediatek/mt76/tx.c +++ b/drivers/net/wireless/mediatek/mt76/tx.c @@ -285,7 +285,7 @@ mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta, skb_set_queue_mapping(skb, qid); } - if (!(wcid->tx_info & MT_WCID_TX_INFO_SET)) + if (wcid && !(wcid->tx_info & MT_WCID_TX_INFO_SET)) ieee80211_get_tx_rates(info->control.vif, sta, skb, info->control.rates, 1);