]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
media: gspca/sunplus: fix zero-length control requests
authorJohan Hovold <johan@kernel.org>
Mon, 24 May 2021 11:09:19 +0000 (13:09 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 20 Sep 2021 13:39:27 +0000 (15:39 +0200)
commitfd17493cdd0a9d57202eb63ec1d0eee8925b9bb2
treefde9889fdf6050df27fc8153f06bb3000eeb08de
parent82e1d5e25327dd1ef8befcbb3330eccf5b66d781
media: gspca/sunplus: fix zero-length control requests

BugLink: https://bugs.launchpad.net/bugs/1939450
commit b4bb4d425b7b02424afea2dfdcd77b3b4794175e upstream.

The direction of the pipe argument must match the request-type direction
bit or control requests may fail depending on the host-controller-driver
implementation.

Control transfers without a data stage are treated as OUT requests by
the USB stack and should be using usb_sndctrlpipe(). Failing to do so
will now trigger a warning.

Fix the single zero-length control request which was using the
read-register helper, and update the helper so that zero-length reads
fail with an error message instead.

Fixes: 6a7eba24e4f0 ("V4L/DVB (8157): gspca: all subdrivers")
Cc: stable@vger.kernel.org # 2.6.27
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/media/usb/gspca/sunplus.c