Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1351241ybp; Thu, 17 Oct 2019 11:27:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzUuNi20qswxv7Mpi8y7qBDk1O06sUxOy13YyTBkjjbQUqWIDNIc2ovKxYfPTwxBGrACil6 X-Received: by 2002:a17:906:745:: with SMTP id z5mr4986588ejb.41.1571336872841; Thu, 17 Oct 2019 11:27:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571336872; cv=none; d=google.com; s=arc-20160816; b=guNpTG10eMAvswma4TRtBkw7039KNsfUj2Gzt9RL00b9zqo7+3Mg2g0ADW6iejrdyf pga04qFI67/CDlOHobzXTwtJGnF3mc4JPLXHq/aYLXTc+1KsjuPoeFvvk1TB3SpZeMTB kpoc1rFRfmaNQp4qzLvpYmcll9X0LsUCe0X4Sm3JU/pMO19zDF880FhiQkS55DVBNDdv AvvQDUM1TwBqsYR7VLcpcXPXW20yGi/GhgHOFSOcqFBPmRmYDUixNtRmnzDAU4Q5Woyy R7DygFzyZgAOgZJ5sAUCbEX+Ka5NRvmsZ3pMZZR7Za/Ms33JxJxuSHlXj/9n8EJTbiZq V4kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y1rCDrJTeYD5qRsJvVnkpBIwQBAY6j9gngS1TItvXHE=; b=o7UzYamoOd69YbIIFSQUkuBBM9gY4hHz2WDDgUxtsvokQCFtuqmcE0SgoPgd/xkXcR XhV4a2fLRfks2hqNiLhX83On3JvkVzUzWBlQWm4YNSuObNDQXllFTcn+m1K9fsFeV0/B fNnctCapzoZWkUKFlxcR1MplSk+npWGV6CHMf1pEPaHbUnYuPfNsyHTx525fwApEhyOR jwZ7a5YzCIoPhv0fyZVAMToA+349RJ8/JoRWZOW0+Pp2J9FkoIu2M2X/i5tEC1RjCGtf ZWSDST5Ij9vzSuH/BzJKgr/SGJgIrp9tx0siSGs5RWwivzTb592KhQ7ULCirGz+ZgrQK aRvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UX5lW26c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l18si2119231edb.155.2019.10.17.11.27.29; Thu, 17 Oct 2019 11:27:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UX5lW26c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392305AbfJPWF6 (ORCPT + 99 others); Wed, 16 Oct 2019 18:05:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:52298 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438219AbfJPV6j (ORCPT ); Wed, 16 Oct 2019 17:58:39 -0400 Received: from localhost (unknown [192.55.54.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A594921925; Wed, 16 Oct 2019 21:58:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571263118; bh=lj5SyutIuB+v6o6QuSFGb7RdNjIqMBjSC10nXV1Da08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UX5lW26c/R3+m/vFW6bPNO566/DcisPbliqdQIpLLgQJtvayzKZ8TNq424HEVIXZa XDmdv3QwNnmkISKnWLDmUm4p3okTJrIJW3GRzXz+VISOhr86B/ZzSizbD+xTDy0sW1 j9Al4gczjcqcrBge7v4tpa1P/Ych8iFEBMDfdGQo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 5.3 042/112] USB: legousbtower: fix open after failed reset request Date: Wed, 16 Oct 2019 14:50:34 -0700 Message-Id: <20191016214854.594079330@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214844.038848564@linuxfoundation.org> References: <20191016214844.038848564@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johan Hovold commit 0b074f6986751361ff442bc1127c1648567aa8d6 upstream. The driver would return with a nonzero open count in case the reset control request failed. This would prevent any further attempts to open the char dev until the device was disconnected. Fix this by incrementing the open count only on successful open. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Johan Hovold Cc: stable Link: https://lore.kernel.org/r/20190919083039.30898-5-johan@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/misc/legousbtower.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -348,7 +348,6 @@ static int tower_open (struct inode *ino retval = -EBUSY; goto unlock_exit; } - dev->open_count = 1; /* reset the tower */ result = usb_control_msg (dev->udev, @@ -388,13 +387,14 @@ static int tower_open (struct inode *ino dev_err(&dev->udev->dev, "Couldn't submit interrupt_in_urb %d\n", retval); dev->interrupt_in_running = 0; - dev->open_count = 0; goto unlock_exit; } /* save device in the file's private structure */ file->private_data = dev; + dev->open_count = 1; + unlock_exit: mutex_unlock(&dev->lock);