mac80211: fix error handling in ieee80211_register_hw()
authorWei Yongjun <weiyongjun1@huawei.com>
Wed, 26 Sep 2018 12:17:17 +0000 (12:17 +0000)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 2 Oct 2018 07:56:29 +0000 (09:56 +0200)
Fix to return a negative error code -ENOMEM from the kmemdup
error handling case instead of 0.

Fixes: 09b4a4faf9d0 ("mac80211: introduce capability flags for VHT EXT NSS support")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/main.c

index 77381017bac77106ec15ec25139cc32223904a39..e6375d035355f348da6e3025bd28a5ea3bc2f432 100644 (file)
@@ -1203,8 +1203,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
                        continue;
 
                sband = kmemdup(sband, sizeof(*sband), GFP_KERNEL);
-               if (!sband)
+               if (!sband) {
+                       result = -ENOMEM;
                        goto fail_rate;
+               }
 
                wiphy_dbg(hw->wiphy, "copying sband (band %d) due to VHT EXT NSS BW flag\n",
                          band);