summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>2017-12-14 15:03:17 +0300
committerKalle Valo <kvalo@codeaurora.org>2018-01-17 17:49:07 +0300
commit98051872fd25077d3b106ab3d2b945fa7025c1ef (patch)
tree6633125123827551556944a3d804cd22cd8e152f /drivers/net/wireless/mediatek
parent99ac5327e902a56ca21365ed3d6e5249fe296ba6 (diff)
downloadlinux-98051872fd25077d3b106ab3d2b945fa7025c1ef.tar.xz
mt76: fix possible NULL pointer dereferencing in mt76x2_mac_write_txwi()
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>
Diffstat (limited to 'drivers/net/wireless/mediatek')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x2_mac.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
index ecc23f58da98..f7c0df0759f7 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c
@@ -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;