]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iwlwifi: check kasprintf() return value
authorJohannes Berg <johannes.berg@intel.com>
Tue, 5 Nov 2019 13:50:32 +0000 (14:50 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 11 Feb 2020 20:03:45 +0000 (20:03 +0000)
commit 5974fbb5e10b018fdbe3c3b81cb4cc54e1105ab9 upstream.

kasprintf() can fail, we should check the return value.

Fixes: 5ed540aecc2a ("iwlwifi: use mac80211 throughput trigger")
Fixes: 8ca151b568b6 ("iwlwifi: add the MVM driver")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
[bwh: Backported to 3.16: adjust filenames]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/wireless/iwlwifi/dvm/led.c
drivers/net/wireless/iwlwifi/mvm/led.c

index ca4d6692cc4eb94907cfe32acd227df07f57046a..47e5fa70483d1890770b9c2023d828c2fdae4d5e 100644 (file)
@@ -184,6 +184,9 @@ void iwl_leds_init(struct iwl_priv *priv)
 
        priv->led.name = kasprintf(GFP_KERNEL, "%s-led",
                                   wiphy_name(priv->hw->wiphy));
+       if (!priv->led.name)
+               return;
+
        priv->led.brightness_set = iwl_led_brightness_set;
        priv->led.blink_set = iwl_led_blink_set;
        priv->led.max_brightness = 1;
index e3b3cf4dbd77a461916589f3dc59f4f11aead0c5..948be43e4d266e7a5d03b784c555c036f5622840 100644 (file)
@@ -109,6 +109,9 @@ int iwl_mvm_leds_init(struct iwl_mvm *mvm)
 
        mvm->led.name = kasprintf(GFP_KERNEL, "%s-led",
                                   wiphy_name(mvm->hw->wiphy));
+       if (!mvm->led.name)
+               return -ENOMEM;
+
        mvm->led.brightness_set = iwl_led_brightness_set;
        mvm->led.max_brightness = 1;