diff options
author | Lorenzo Bianconi <lorenzo@kernel.org> | 2020-08-21 13:52:15 +0300 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2020-08-22 22:19:24 +0300 |
commit | 8c7c1a207d25cd880c7f54d3fe86e82f14d6ecda (patch) | |
tree | 91d3cef6163dd5837d0c400c32432284ee331850 /testmode.c | |
parent | 37a1c7ed6796a98836141e20a75915a892f1d464 (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.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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; } |