wifi: nl80211: call kfree without a NULL check
PATCH 1/1 wifi: nl80211: call kfree without a NULL check
Coverity is unhappy because we may leak old_radio_rts_threshold. Since this pointer is only valid in the context of the function and kfree is NULL pointer safe, don't check and just call kfree.
Note that somehow, we were checking old_rts_threshold to free old_radio_rts_threshold which is a bit odd.
--- net/wireless/nl80211.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/wireless/nl80211.c +1 -2
@@ -4136,8 +4136,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) rdev->wiphy.txq_quantum = old_txq_quantum; } -if (old_rts_threshold) -kfree (old_radio_rts_threshold); +kfree (old_radio_rts_threshold);return result; }
Signature · 1 line
2.51.0
Quoted 1 line · Emmanuel Grumbach
Coverity is unhappy because we may leak
old_radio_rts_threshold.
Is this being flagged in a public Coverity instance?
I don't see this at either of:
https://scan.coverity.com/projects/linux
https://scan.coverity.com/projects/linux-next-weekly-scan
Quoted 1 line
Fixes 264637941cf4 ("wifi: cfg80211: Add Support to Set RTS Threshold for each Radio")
If there is a public instance, would be nice to add a Closes: tag that points to it
Quoted 1 line
Reviewed-by Johannes Berg <[email protected]>
Quoted 19 lines
Signed-off-by Emmanuel Grumbach <[email protected]>--- net/wireless/nl80211.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)net/wireless/nl80211.c +1
-2@@ -4136,8 +4136,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) rdev->wiphy.txq_quantum = old_txq_quantum; } -if (old_rts_threshold) -kfree (old_radio_rts_threshold); +kfree (old_radio_rts_threshold);return result; }
Quoted 9 lines · Jeff Johnson
Quoted 1 line · Emmanuel Grumbach
Coverity is unhappy because we may leak
old_radio_rts_threshold.Is this being flagged in a public Coverity instance?
I don't see this at either of:
https://scan.coverity.com/projects/linux
https://scan.coverity.com/projects/linux-next-weekly-scan
Not that I am aware of. This was flagged by our internal instance.
Quoted 31 lines
Quoted 2 lines
Fixes 264637941cf4 ("wifi: cfg80211: Add Support to Set RTSThreshold for each Radio")
If there is a public instance, would be nice to add a Closes: tag that points
to itQuoted 1 line
Reviewed-by Johannes Berg <[email protected]>Reviewed-by Jeff Johnson <[email protected]>Quoted 20 lines
Signed-off-by Emmanuel Grumbach <[email protected]>---
net/wireless/nl80211.c | 3 +--1 file changed, 1 insertion(+), 2 deletions(-)net/wireless/nl80211.c +0
-0@@ -4136,8 +4136,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) rdev->wiphy.txq_quantum = old_txq_quantum; }net/wireless/nl80211.c +1
-2-if (old_rts_threshold) -kfree (old_radio_rts_threshold); +kfree (old_radio_rts_threshold);return result;
}