Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2338055ybz; Thu, 23 Apr 2020 16:17:37 -0700 (PDT) X-Google-Smtp-Source: APiQypK61JHQpk7w14oMsOYhsoMxbedAqoU35bkr/0v2ag21UDAoHzBd+HoXjBwpCLYNxd7Md3g2 X-Received: by 2002:a17:906:4406:: with SMTP id x6mr4899996ejo.160.1587683857298; Thu, 23 Apr 2020 16:17:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587683857; cv=none; d=google.com; s=arc-20160816; b=qvPVH5+0gxnIM2blP0i3DUsQP9Doe9UaQx9mdDzvEheGkk3Am59nS2YA+SntNF/y3z xU+Pvq80opaG+4xAX9kI0+b7Q1WnS3UDZl5DBft+rTIgW0sQbLqKQYmXIV6OY//DvORS gt3LwucQwXDThgT0dyTF89sNfok6c0FO5pdozVd0bfrC4EOM+VwVSNYDPYsuJ9OIgJWO 6K2cuY/8727mAXXuJ8EJwWIvlxoplo3AT/9v1oWHq5SFzv+BKbfqxLAf4P52umc7kpin NyiqFiOasJ/CoxBYJ8AQltM/HPiJ6ALSsmep2Yn4FOMt3KMalJSo+CB3eRmp2jNpRzd4 MfFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=tqVfpfCvuy86yycqUswxZ/ODNypa1o/34vzuuN4nGS8=; b=dJ1vnQeQWIllUnO3xJvALUkwLZ+B5Q/mIAwvQMcfAO6TprHwjhVHQDa5RPG3PicCgR STYXwUzrT2tBKk5+B3f4fKAsC0iEJoXfrJqGSlpBRuP2OKSiepgA7ZKZ/LNjEmGIgtGX h5EAec5N9yRdx15CCa8CU1yOLUuLYGM7e7MXPqNtQ8dZWClsV6dfLRT92oMOLr8xWi+s cji4bStJeMwNe/HkvCcFNHxv/bx5e1jN+wwYruPH+k/8HhMB6AeA/5aiSbPhNFjf4fHJ X6wQoZRNhTWXmZ2noa6CcCfuD6jjwmhQWD9mqMN9JqiA5S2Ecld3dLO1nIK01xU9HBTX nXVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c20si1969701ejb.236.2020.04.23.16.17.14; Thu, 23 Apr 2020 16:17:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729331AbgDWXMc (ORCPT + 99 others); Thu, 23 Apr 2020 19:12:32 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:50174 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728534AbgDWXGv (ORCPT ); Thu, 23 Apr 2020 19:06:51 -0400 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1jRkva-0004lg-Pc; Fri, 24 Apr 2020 00:06:43 +0100 Received: from ben by deadeye with local (Exim 4.93) (envelope-from ) id 1jRkvX-00E6xD-4m; Fri, 24 Apr 2020 00:06:39 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "Johan Hovold" , "Dmitry Torokhov" , "Greg Kroah-Hartman" Date: Fri, 24 Apr 2020 00:06:58 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 191/245] Input: keyspan-remote - fix control-message timeouts In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.83-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit ba9a103f40fc4a3ec7558ec9b0b97d4f92034249 upstream. The driver was issuing synchronous uninterruptible control requests without using a timeout. This could lead to the driver hanging on probe due to a malfunctioning (or malicious) device until the device is physically disconnected. While sleeping in probe the driver prevents other devices connected to the same hub from being added to (or removed from) the bus. The USB upper limit of five seconds per request should be more than enough. Fixes: 99f83c9c9ac9 ("[PATCH] USB: add driver for Keyspan Digital Remote") Signed-off-by: Johan Hovold Reviewed-by: Greg Kroah-Hartman Link: https://lore.kernel.org/r/20200113171715.30621-1-johan@kernel.org Signed-off-by: Dmitry Torokhov Signed-off-by: Ben Hutchings --- drivers/input/misc/keyspan_remote.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/input/misc/keyspan_remote.c +++ b/drivers/input/misc/keyspan_remote.c @@ -344,7 +344,8 @@ static int keyspan_setup(struct usb_devi int retval = 0; retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), - 0x11, 0x40, 0x5601, 0x0, NULL, 0, 0); + 0x11, 0x40, 0x5601, 0x0, NULL, 0, + USB_CTRL_SET_TIMEOUT); if (retval) { dev_dbg(&dev->dev, "%s - failed to set bit rate due to error: %d\n", __func__, retval); @@ -352,7 +353,8 @@ static int keyspan_setup(struct usb_devi } retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), - 0x44, 0x40, 0x0, 0x0, NULL, 0, 0); + 0x44, 0x40, 0x0, 0x0, NULL, 0, + USB_CTRL_SET_TIMEOUT); if (retval) { dev_dbg(&dev->dev, "%s - failed to set resume sensitivity due to error: %d\n", __func__, retval); @@ -360,7 +362,8 @@ static int keyspan_setup(struct usb_devi } retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), - 0x22, 0x40, 0x0, 0x0, NULL, 0, 0); + 0x22, 0x40, 0x0, 0x0, NULL, 0, + USB_CTRL_SET_TIMEOUT); if (retval) { dev_dbg(&dev->dev, "%s - failed to turn receive on due to error: %d\n", __func__, retval);