mwifiex: fix NULL pointer dereference in mwifiex_fw_dpc

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Nov 22 17:59:07 EST 2013


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=d1af2943da89f180274c846d593049e464026baf
Commit:     d1af2943da89f180274c846d593049e464026baf
Parent:     bec568ff51078276109e21b5521829e2dd60a7fa
Author:     Amitkumar Karwar <akarwar at marvell.com>
AuthorDate: Thu Nov 14 19:10:39 2013 -0800
Committer:  John W. Linville <linville at tuxdriver.com>
CommitDate: Fri Nov 15 14:29:31 2013 -0500

    mwifiex: fix NULL pointer dereference in mwifiex_fw_dpc
    
    We don't need to free/unregister wiphy when
    mwifiex_register_cfg80211() fails. The routine internally takes
    care of it. This redundant code can cause NULL pointer dereference,
    for adapter->wiphy.
    
    Reported-by: Ujjal Roy <royujjal at gmail.com>
    Signed-off-by: Amitkumar Karwar <akarwar at marvell.com>
    Signed-off-by: Bing Zhao <bzhao at marvell.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>
---
 drivers/net/wireless/mwifiex/main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index 9236b42..42d9a68 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -470,7 +470,7 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context)
 	priv = adapter->priv[MWIFIEX_BSS_ROLE_STA];
 	if (mwifiex_register_cfg80211(adapter)) {
 		dev_err(adapter->dev, "cannot register with cfg80211\n");
-		goto err_register_cfg80211;
+		goto err_init_fw;
 	}
 
 	rtnl_lock();
@@ -489,7 +489,6 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context)
 	goto done;
 
 err_add_intf:
-err_register_cfg80211:
 	wiphy_unregister(adapter->wiphy);
 	wiphy_free(adapter->wiphy);
 err_init_fw:



More information about the linux-mtd-cvs mailing list