From patchwork Sun Jul 15 22:48:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 1199571 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 455A73FC33 for ; Sun, 15 Jul 2012 22:48:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752028Ab2GOWsH (ORCPT ); Sun, 15 Jul 2012 18:48:07 -0400 Received: from mtaout01-winn.ispmail.ntl.com ([81.103.221.47]:3079 "EHLO mtaout01-winn.ispmail.ntl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751161Ab2GOWsF (ORCPT ); Sun, 15 Jul 2012 18:48:05 -0400 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20120715224803.OIXY3118.mtaout01-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com>; Sun, 15 Jul 2012 23:48:03 +0100 Received: from zog.reactivated.net ([86.14.215.141]) by aamtaout02-winn.ispmail.ntl.com (InterMail vG.3.00.04.00 201-2196-133-20080908) with ESMTP id <20120715224803.RWPQ10303.aamtaout02-winn.ispmail.ntl.com@zog.reactivated.net>; Sun, 15 Jul 2012 23:48:03 +0100 Received: by zog.reactivated.net (Postfix, from userid 1000) id 008E69D401F; Sun, 15 Jul 2012 23:48:00 +0100 (BST) From: Daniel Drake To: dcbw@redhat.com, linville@tuxdriver.com Cc: linux-wireless@vger.kernel.org, libertas-dev@lists.infradead.org Subject: [PATCH 3/3] libertas USB: don't set surpriseremoved flag Message-Id: <20120715224801.008E69D401F@zog.reactivated.net> Date: Sun, 15 Jul 2012 23:48:00 +0100 (BST) X-Cloudmark-Analysis: v=1.1 cv=GaEGOwq9FwezmTggA+b6yC6zDZF2HYaK6RN/tSqdnVA= c=1 sm=0 a=qEznUBDNTd4A:10 a=vJ1w_8FsMGIA:10 a=Op-mwl0xAAAA:8 a=EkwBDOjwB6ap6EmEUmkA:9 a=d4CUUju0HPYA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org We found a deadlock in the handling of command failures/reset conditions. For example: 1. Two commands are in the queue. 2. The first command is sent, but causes a timeout, which kicks off an asynchronous device reset 3. The second command is queued (but not yet sent to the hardware) 4. The device reset kicks in, causing the if_usb disconnect handler to set the "surprise removed" flag to be set as the device disappears from the bus. This causes lbs_thread to stop processing things ("adapter removed; waiting to die"), not processing any further commands, leaving the second queued command "in the air", causing a deadlock. Fix this by removing the surpriseremoved flag setting in if_usb. I can't see any reason why this needs to be done so early. lbs_remove_card will set this flag at an appropriate time - i.e. after all pending commands have been completed or cancelled, avoiding this deadlock. Signed-off-by: Daniel Drake --- drivers/net/wireless/libertas/if_usb.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index cd3b0d4..92b6885 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -309,7 +309,6 @@ static void if_usb_disconnect(struct usb_interface *intf) cardp->surprise_removed = 1; if (priv) { - priv->surpriseremoved = 1; lbs_stop_card(priv); lbs_remove_card(priv); }