Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3289690ybb; Tue, 31 Mar 2020 02:11:47 -0700 (PDT) X-Google-Smtp-Source: ADFU+vseZUqz35Mdg3GTmDJxuj9q2+8z+Z6B7sYVDX0p2h+s7fvXRxxPyyuJ4TbbhPSwknDfiTXj X-Received: by 2002:a9d:60b:: with SMTP id 11mr7658071otn.126.1585645906965; Tue, 31 Mar 2020 02:11:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585645906; cv=none; d=google.com; s=arc-20160816; b=eeS/QeypHKSXeN7thNaJ8jiuf1ZuQ0GBTrrgNG4Cphz3jA4rIJilNG+cI+gfJT4BfD 6glqA/qfBzgh8oXD429pQxjzMV7vW1uTzaQt0sqRd3oP+8lQcKo2UwpaJpbctBwSjI8f DaSjhOF6QGGrplupsSZ4BuuFDDWtxUs5bUltm1ukz2dlxtaD2oo5M5TF+FZgazzfAwtC 0gzzznSlKdmBheyX0zzhJq0ACJbD7K4zOoI+mxEDxho/lQA0xRQFZJMUXwIvd3QFnYUd Nd7nHaut85vv/bS3rxMMDrLsFvhXE3XZZ4jRJBPSjiV3y7qWDANDvH0K6Tb6g8Y/Fzf6 z9jQ== 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=Co8nZBw+yG1FTur/AQmRr4Xl7vdsAkqNjyw4vYgieu8=; b=YDZKYiZovV3n+JQnsNvYikl5TlygsFBOcDM3NHoyDBhyO9wJ7ZEWTBFApP2aHXybxf NKvYEC9aVUVivKdlKECvPL1OFXg47O86kMwQZoW+RU/24LM4Q87Q1DQo8SBbc1wnGVVA HKoUuR3MYzB5Zy2VBq1G7rw19o7RGTlh8+wkM/RyG+Td023W/6u8qAK8Zlvd0hGOdrHc EY80cpcdTL6m9lUNHP+FR2YyDi+8MsFF2B/L4WZM/B4JsE8Hw642UCgRWRMo9Hujv4BD ee7s0J6Vvdqadb58lmtOgZ97jmNhvN9t9dEjCKbNEeMuKw7PlJEDP07jCzx3xk8eiqVr B41g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Xq7rWRkV; 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 q25si7638997otn.323.2020.03.31.02.11.34; Tue, 31 Mar 2020 02:11:46 -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=Xq7rWRkV; 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 S1731572AbgCaJKN (ORCPT + 99 others); Tue, 31 Mar 2020 05:10:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:53814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731285AbgCaJKJ (ORCPT ); Tue, 31 Mar 2020 05:10:09 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 BA312208E0; Tue, 31 Mar 2020 09:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585645809; bh=7GkF9U1QC4/acQ/zYteAI1o0BdFXo/0FC7l9Hnlp3EQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xq7rWRkVh3kdliAc8aBd8UHJUpO9iJKbp+MTUz7PX6AA8GOSnbu55NjmMfAW7QgXd KlvYd5YX6d/PKC1qx0P979dmm9hdSOr0mdwnMetH4dutamUIYqUscxvtJ+pHHwR4os dUxzngef5sOzsElj1kgdX2D6Ezyebuf5Xamir9ok= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Lubomir Rintel , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.5 156/170] media: usbtv: fix control-message timeouts Date: Tue, 31 Mar 2020 10:59:30 +0200 Message-Id: <20200331085439.555963175@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200331085423.990189598@linuxfoundation.org> References: <20200331085423.990189598@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 536f561d871c5781bc33d26d415685211b94032e upstream. The driver was issuing synchronous uninterruptible control requests without using a timeout. This could lead to the driver hanging on various user requests due to a malfunctioning (or malicious) device until the device is physically disconnected. The USB upper limit of five seconds per request should be more than enough. Fixes: f3d27f34fdd7 ("[media] usbtv: Add driver for Fushicai USBTV007 video frame grabber") Fixes: c53a846c48f2 ("[media] usbtv: add video controls") Cc: stable # 3.11 Signed-off-by: Johan Hovold Acked-by: Lubomir Rintel Reviewed-by: Greg Kroah-Hartman Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/usb/usbtv/usbtv-core.c | 2 +- drivers/media/usb/usbtv/usbtv-video.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) --- a/drivers/media/usb/usbtv/usbtv-core.c +++ b/drivers/media/usb/usbtv/usbtv-core.c @@ -56,7 +56,7 @@ int usbtv_set_regs(struct usbtv *usbtv, ret = usb_control_msg(usbtv->udev, pipe, USBTV_REQUEST_REG, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - value, index, NULL, 0, 0); + value, index, NULL, 0, USB_CTRL_GET_TIMEOUT); if (ret < 0) return ret; } --- a/drivers/media/usb/usbtv/usbtv-video.c +++ b/drivers/media/usb/usbtv/usbtv-video.c @@ -800,7 +800,8 @@ static int usbtv_s_ctrl(struct v4l2_ctrl ret = usb_control_msg(usbtv->udev, usb_rcvctrlpipe(usbtv->udev, 0), USBTV_CONTROL_REG, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0, USBTV_BASE + 0x0244, (void *)data, 3, 0); + 0, USBTV_BASE + 0x0244, (void *)data, 3, + USB_CTRL_GET_TIMEOUT); if (ret < 0) goto error; } @@ -851,7 +852,7 @@ static int usbtv_s_ctrl(struct v4l2_ctrl ret = usb_control_msg(usbtv->udev, usb_sndctrlpipe(usbtv->udev, 0), USBTV_CONTROL_REG, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0, index, (void *)data, size, 0); + 0, index, (void *)data, size, USB_CTRL_SET_TIMEOUT); error: if (ret < 0)