Staging: wlan-ng: wiphy_free() is not called in case wiphy_register() fails
authorClaudiu Beznea <claudiu.beznea@gmail.com>
Wed, 23 Mar 2016 18:37:26 +0000 (20:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Mar 2016 14:30:36 +0000 (07:30 -0700)
This patch covers wiphy_register() failures in wlan_create_wiphy()
from cfg80211.c by calling wiphy_free() for the correspondent
struct wiphy allocated structure.

Signed-off-by: Claudiu Beznea <claudiu.beznea@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wlan-ng/cfg80211.c

index 8bad018eda478d7f741bcc6950f5772e6f87afc9..ee989d1d57152de5f3656ffa013a7f22ef8a73dd 100644 (file)
@@ -771,8 +771,10 @@ static struct wiphy *wlan_create_wiphy(struct device *dev, wlandevice_t *wlandev
        wiphy->n_cipher_suites = PRISM2_NUM_CIPHER_SUITES;
        wiphy->cipher_suites = prism2_cipher_suites;
 
-       if (wiphy_register(wiphy) < 0)
+       if (wiphy_register(wiphy) < 0) {
+               wiphy_free(wiphy);
                return NULL;
+       }
 
        return wiphy;
 }