]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
mt76: fix possible NULL pointer dereferencing in mt76x2_mac_write_txwi()
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Thu, 14 Dec 2017 12:03:17 +0000 (13:03 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 17 Jan 2018 14:49:07 +0000 (16:49 +0200)
Verify wcid is not NULL before dereferencing the pointer to initialize
txwi rate/power info

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c

index ecc23f58da983282987cfad49b7a87c912123194..f7c0df0759f7a470838f8807f8e24a595c474691 100644 (file)
@@ -186,7 +186,7 @@ void mt76x2_mac_write_txwi(struct mt76x2_dev *dev, struct mt76x2_txwi *txwi,
        txwi->pktid = 1;
 
        spin_lock_bh(&dev->mt76.lock);
-       if (rate->idx < 0 || !rate->count) {
+       if (wcid && (rate->idx < 0 || !rate->count)) {
                txwi->rate = wcid->tx_rate;
                max_txpwr_adj = wcid->max_txpwr_adj;
                nss = wcid->tx_rate_nss;