Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp229764ybg; Thu, 17 Oct 2019 22:01:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9EAymqCgQR8Yjy4aL6eNIobplBlC7nW7VBc20ptoJVb9rD0uFnFTdYie7jlVEMSgyf6na X-Received: by 2002:aa7:c2d7:: with SMTP id m23mr7672795edp.206.1571374872775; Thu, 17 Oct 2019 22:01:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571374872; cv=none; d=google.com; s=arc-20160816; b=G2JZImo59/OkIaO6gNwncnnVLTnMxnufIgkHReT5UVgY3Rtaei3tsHCF7F+A3d1qkF +YL0DNHhU34CfWi7FhNeEFRa3wjY8deEfNKOfqGpIedFj+Ne6okJFh0ohnc75dCiDyWc /fqh/yilmm81RsKG/ZlshzM0GaJfiuLAYo8AUO48wCGKt2Nb0Jp4IW2Evv9VvkJVN8jA w3WXv78aRJLXo6TPS4v/x2BeFofj5PigT2jaymIKwF3PCWAnxp/nl2ZJ8ABhENbpTqfg 3Vn09gRtgm7I9pG2alX+AFNerH4X0HnYiJxRuWfzIqQKIIJ/f1Xt3BSsoJn/0e+8wC79 g1fg== 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=Jsj3IiPmAKNqsvKYno8nBBya+EAhzZceK19ubZhrclo=; b=mhZc2B6BJfF2muLxXefZ2IAmlPS00Jyxd3Cwal6rLZ95oEZ2WKTwuiO9qJrTD9cp3o 8qYuKqgHhIcQrexOL8SURc81rFUfjOmjHTMGY+7LI6RjOygNLWuPY/wrTEcKEEMzSiaa /suvzhWi2iVXbszl5LEuvyqOz5mixIKySqGsRTs2nefQlePxonK0CvivN1kSC2AU8Nx7 6HFXIaWfD/9QVaD1deZ6Zf3+jJ7vHzNdBJ7I15Axp7Ny/e4dQlADhGwQ6g6acHAZ+e29 lvFV7f56AajHWwu2twIa6Gr7WUBJGXJUWc54m7li+vLPI/4ROrUB9Pp7RvdFcEkK2JOE mucA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QzzBZYLh; 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 w26si3235863edd.305.2019.10.17.22.00.49; Thu, 17 Oct 2019 22:01:12 -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=QzzBZYLh; 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 S2407461AbfJPWQP (ORCPT + 99 others); Wed, 16 Oct 2019 18:16:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:45636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437714AbfJPVzM (ORCPT ); Wed, 16 Oct 2019 17:55:12 -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 9916921925; Wed, 16 Oct 2019 21:55:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571262911; bh=/65x1RXpW1BL+sNWRXmIXwJn2MK+GW4GX8yPWk69DX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QzzBZYLhRiaYn1LNhIccb5i52m+AkiTKLf6dQeunYHW521LG6TM81eniX8rRfSZDR Dh/ZS5wRoVFGSsOj3X/qihQYebN8eV1b8Z2aczwkvOF++LJmwoY/A9E0gGBFCdIm1u clEWcouTUsFjURHSScF4Pnsk9QHOd5naSMtdcYAU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 4.9 71/92] USB: legousbtower: fix open after failed reset request Date: Wed, 16 Oct 2019 14:50:44 -0700 Message-Id: <20191016214844.217006132@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214759.600329427@linuxfoundation.org> References: <20191016214759.600329427@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 @@ -354,7 +354,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, @@ -394,13 +393,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);