linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eugene Teo <eugeneteo@kernel.sg>
To: linux-wireless@vger.kernel.org
Cc: "John W. Linville" <linville@tuxdriver.com>
Subject: [PATCH] drivers/net/wireless/libertas/cmd.c: fix  adapter->driver_lock dereference
Date: Thu, 19 Jul 2007 21:59:23 +0800	[thread overview]
Message-ID: <20070719135923.GA29142@kernel.sg> (raw)

adapter is NULL if cmdnode is not.

Signed-off-by: Eugene Teo <eugeneteo@kernel.sg>
---
 drivers/net/wireless/libertas/cmd.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 4a8f5dc..03af8bb 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -941,7 +941,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;
 
@@ -950,12 +950,6 @@ static int DownloadcommandToStation(wlan_private * priv,
 	if (!adapter || !cmdnode) {
 		lbs_deb_cmd("DNLD_CMD: adapter = %p, cmdnode = %p\n",
 		       adapter, cmdnode);
-		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;
 	}
 
@@ -968,7 +962,6 @@ static int DownloadcommandToStation(wlan_private * priv,
 		       "Not sending\n");
 		__libertas_cleanup_and_insert_cmd(priv, cmdnode);
 		spin_unlock_irqrestore(&adapter->driver_lock, flags);
-		ret = -1;
 		goto done;
 	}
 
@@ -993,7 +986,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;
 	}
 
-- 
1.5.2.2


             reply	other threads:[~2007-07-19 13:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-19 13:59 Eugene Teo [this message]
2007-07-19 20:07 ` [PATCH] drivers/net/wireless/libertas/cmd.c: fix adapter->driver_lock dereference Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070719135923.GA29142@kernel.sg \
    --to=eugeneteo@kernel.sg \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).