Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/openwrt/mt76.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2020-08-21 13:52:15 +0300
committerFelix Fietkau <nbd@nbd.name>2020-08-22 22:19:24 +0300
commit8c7c1a207d25cd880c7f54d3fe86e82f14d6ecda (patch)
tree91d3cef6163dd5837d0c400c32432284ee331850 /testmode.c
parent37a1c7ed6796a98836141e20a75915a892f1d464 (diff)
mt76: fix a possible NULL pointer dereference in mt76_testmode_dump
Fix a possible NULL pointer dereference in mt76_testmode_dump() since nla_nest_start returns NULL in case of error Fixes: f0efa8621550e ("mt76: add API for testmode support") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'testmode.c')
-rw-r--r--testmode.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/testmode.c b/testmode.c
index 3be4e2ff..1653f0b1 100644
--- a/testmode.c
+++ b/testmode.c
@@ -442,9 +442,13 @@ int mt76_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *msg,
mutex_lock(&dev->mutex);
if (tb[MT76_TM_ATTR_STATS]) {
+ err = -EINVAL;
+
a = nla_nest_start(msg, MT76_TM_ATTR_STATS);
- err = mt76_testmode_dump_stats(dev, msg);
- nla_nest_end(msg, a);
+ if (a) {
+ err = mt76_testmode_dump_stats(dev, msg);
+ nla_nest_end(msg, a);
+ }
goto out;
}