[PATCH] drivers/net/wireless/libertas/cmd.c: fix adapter->driver_lock dereference
authorEugene Teo <eugeneteo@kernel.sg>
Thu, 2 Aug 2007 17:18:07 +0000 (13:18 -0400)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 10 Oct 2007 23:50:14 +0000 (16:50 -0700)
adapter is NULL if cmdnode is not.

Signed-off-by: Eugene Teo <eugeneteo@kernel.sg>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/libertas/cmd.c

index 257d6443f6c7c561bc180e3ee346ef7c33f531ec..72e8e27a6fb79fdb20ba325cbf8686c11c7e20e5 100644 (file)
@@ -958,7 +958,7 @@ static int DownloadcommandToStation(wlan_private * priv,
        unsigned long flags;
        struct cmd_ds_command *cmdptr;
        wlan_adapter *adapter = priv->adapter;
-       int ret = 0;
+       int ret = -1;
        u16 cmdsize;
        u16 command;
 
@@ -966,12 +966,6 @@ static int DownloadcommandToStation(wlan_private * priv,
 
        if (!adapter || !cmdnode) {
                lbs_deb_host("DNLD_CMD: adapter or cmdmode is NULL\n");
-               if (cmdnode) {
-                       spin_lock_irqsave(&adapter->driver_lock, flags);
-                       __libertas_cleanup_and_insert_cmd(priv, cmdnode);
-                       spin_unlock_irqrestore(&adapter->driver_lock, flags);
-               }
-               ret = -1;
                goto done;
        }
 
@@ -982,7 +976,6 @@ static int DownloadcommandToStation(wlan_private * priv,
                lbs_deb_host("DNLD_CMD: cmdptr is NULL or zero\n");
                __libertas_cleanup_and_insert_cmd(priv, cmdnode);
                spin_unlock_irqrestore(&adapter->driver_lock, flags);
-               ret = -1;
                goto done;
        }
 
@@ -1008,7 +1001,6 @@ static int DownloadcommandToStation(wlan_private * priv,
                __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
                adapter->cur_cmd = NULL;
                spin_unlock_irqrestore(&adapter->driver_lock, flags);
-               ret = -1;
                goto done;
        }