From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932511Ab2DXWf2 (ORCPT ); Tue, 24 Apr 2012 18:35:28 -0400 Received: from mail-pz0-f51.google.com ([209.85.210.51]:33944 "EHLO mail-pz0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932495Ab2DXWfX (ORCPT ); Tue, 24 Apr 2012 18:35:23 -0400 Message-Id: <20120424223244.451631409@linuxfoundation.org> User-Agent: quilt/0.60-19.1 Date: Tue, 24 Apr 2012 15:33:10 -0700 From: Greg KH To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, Alberto Lago Ballesteros , Adrian , Larry Finger Subject: [ 29/62] staging: r8712u: Fix regression caused by commit 8c213fa In-Reply-To: <20120424223305.GA7748@kroah.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Larry Finger commit 2080913e017ab9f88379d93fd09546ad95faf87b upstream. In commit 8c213fa "staging: r8712u: Use asynchronous firmware loading", the command to release the firmware was placed in the wrong routine. In combination with the bug introduced in commit a5ee652 "staging: r8712u: Interface-state not fully tracked", the driver attempts to upload firmware that had already been released. This bug is the source of one of the problems in https://bugs.archlinux.org/task/27996#comment89833. Tested-by: Alberto Lago Ballesteros Tested-by: Adrian Signed-off-by: Larry Finger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/os_intfs.c | 3 --- drivers/staging/rtl8712/usb_intf.c | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) --- a/drivers/staging/rtl8712/os_intfs.c +++ b/drivers/staging/rtl8712/os_intfs.c @@ -476,9 +476,6 @@ static int netdev_close(struct net_devic r8712_free_assoc_resources(padapter); /*s2-4.*/ r8712_free_network_queue(padapter); - release_firmware(padapter->fw); - /* never exit with a firmware callback pending */ - wait_for_completion(&padapter->rtl8712_fw_ready); return 0; } --- a/drivers/staging/rtl8712/usb_intf.c +++ b/drivers/staging/rtl8712/usb_intf.c @@ -30,6 +30,7 @@ #include #include +#include #include "osdep_service.h" #include "drv_types.h" @@ -621,6 +622,10 @@ static void r871xu_dev_remove(struct usb struct _adapter *padapter = netdev_priv(pnetdev); struct usb_device *udev = interface_to_usbdev(pusb_intf); + if (padapter->fw_found) + release_firmware(padapter->fw); + /* never exit with a firmware callback pending */ + wait_for_completion(&padapter->rtl8712_fw_ready); usb_set_intfdata(pusb_intf, NULL); if (padapter) { if (drvpriv.drv_registered == true)