All of lore.kernel.org
 help / color / mirror / Atom feed
* [git:media_tree/master] media: usbtv: fix control-message timeouts
@ 2020-02-24 15:13 Mauro Carvalho Chehab
  2020-02-28 19:44 ` Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: Mauro Carvalho Chehab @ 2020-02-24 15:13 UTC (permalink / raw)
  To: linuxtv-commits
  Cc: Johan Hovold, Lubomir Rintel, stable, Greg Kroah-Hartman, Hans Verkuil

This is an automatic generated email to let you know that the following patch were queued:

Subject: media: usbtv: fix control-message timeouts
Author:  Johan Hovold <johan@kernel.org>
Date:    Mon Jan 13 18:18:18 2020 +0100

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 <stable@vger.kernel.org>     # 3.11
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

 drivers/media/usb/usbtv/usbtv-core.c  | 2 +-
 drivers/media/usb/usbtv/usbtv-video.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

---

diff --git a/drivers/media/usb/usbtv/usbtv-core.c b/drivers/media/usb/usbtv/usbtv-core.c
index 5095c380b2c1..ee9c656d121f 100644
--- 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, const u16 regs[][2], int size)
 
 		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;
 	}
diff --git a/drivers/media/usb/usbtv/usbtv-video.c b/drivers/media/usb/usbtv/usbtv-video.c
index 3d9284a09ee5..b249f037900c 100644
--- 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 *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 *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)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [git:media_tree/master] media: usbtv: fix control-message timeouts
  2020-02-24 15:13 [git:media_tree/master] media: usbtv: fix control-message timeouts Mauro Carvalho Chehab
@ 2020-02-28 19:44 ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2020-02-28 19:44 UTC (permalink / raw)
  To: Sasha Levin, Mauro Carvalho Chehab, linuxtv-commits
  Cc: Johan Hovold, Lubomir Rintel, stable

Hi

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag
fixing commit: f3d27f34fdd7 ("[media] usbtv: Add driver for Fushicai USBTV007 video frame grabber").

The bot has tested the following trees: v5.5.6, v5.4.22, v4.19.106, v4.14.171, v4.9.214, v4.4.214.

v5.5.6: Build OK!
v5.4.22: Build OK!
v4.19.106: Build OK!
v4.14.171: Build OK!
v4.9.214: Failed to apply! Possible dependencies:
    62de7d99dcfe ("[media] usbtv: don't do DMA on stack")
    b3168c87c049 ("media: usbtv: fix brightness and contrast controls")
    c53a846c48f2 ("[media] usbtv: add video controls")

v4.4.214: Failed to apply! Possible dependencies:
    62de7d99dcfe ("[media] usbtv: don't do DMA on stack")
    b3168c87c049 ("media: usbtv: fix brightness and contrast controls")
    c53a846c48f2 ("[media] usbtv: add video controls")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks
Sasha

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-28 19:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-24 15:13 [git:media_tree/master] media: usbtv: fix control-message timeouts Mauro Carvalho Chehab
2020-02-28 19:44 ` Sasha Levin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.