Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761272AbXLMGzy (ORCPT ); Thu, 13 Dec 2007 01:55:54 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757851AbXLMGz3 (ORCPT ); Thu, 13 Dec 2007 01:55:29 -0500 Received: from pentafluge.infradead.org ([213.146.154.40]:54975 "EHLO pentafluge.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755208AbXLMGz2 (ORCPT ); Thu, 13 Dec 2007 01:55:28 -0500 Date: Wed, 12 Dec 2007 22:50:57 -0800 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , Chuck Ebbert , Domenico Andreoli , torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, Marcelo Tosatti , Marcelo Tosatti , "John W. Linville" Subject: [patch 01/60] libertas: properly account for queue commands Message-ID: <20071213065056.GB6867@kroah.com> References: <20071213064518.328162328@mini.kroah.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="libertas-properly-account-for-queue-commands.patch" In-Reply-To: <20071213065039.GA6867@kroah.com> User-Agent: Mutt/1.5.16 (2007-06-09) X-Bad-Reply: References and In-Reply-To but no 'Re:' in Subject. Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1942 Lines: 62 2.6.23-stable review patch. If anyone has any objections, please let us know. ------------------ From: Marcelo Tosatti patch 29f5f2a19b055feabfcc6f92e1d40ec092c373ea in mainline. Properly account for queue commands, this fixes a problem reported by Holger Schurig when using the debugfs interface. Signed-off-by: Marcelo Tosatti Signed-off-by: John W. Linville Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/libertas/cmd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -881,6 +881,10 @@ static int wlan_cmd_mesh_access(wlan_pri return 0; } +/* + * Note: NEVER use libertas_queue_cmd() with addtail==0 other than for + * the command timer, because it does not account for queued commands. + */ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u8 addtail) { unsigned long flags; @@ -910,10 +914,11 @@ void libertas_queue_cmd(wlan_adapter * a spin_lock_irqsave(&adapter->driver_lock, flags); - if (addtail) + if (addtail) { list_add_tail((struct list_head *)cmdnode, &adapter->cmdpendingq); - else + adapter->nr_cmd_pending++; + } else list_add((struct list_head *)cmdnode, &adapter->cmdpendingq); spin_unlock_irqrestore(&adapter->driver_lock, flags); @@ -1400,7 +1405,6 @@ int libertas_prepare_and_send_command(wl cmdnode->cmdwaitqwoken = 0; libertas_queue_cmd(adapter, cmdnode, 1); - adapter->nr_cmd_pending++; wake_up_interruptible(&priv->mainthread.waitq); if (wait_option & cmd_option_waitforrsp) { -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/