]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
media: uvc: don't do DMA on stack
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 17 Jun 2021 12:33:29 +0000 (14:33 +0200)
committerKelsey Skunberg <kelsey.skunberg@canonical.com>
Tue, 12 Oct 2021 22:31:22 +0000 (16:31 -0600)
commitce18447adfc99b2a8e9410e041a5c9e08d66c289
tree4b65615a0435e5ef840ed5929a92542b22306ee2
parent3ce0a3c7ef7f07b32dd9a40cb19d66f6e036100d
media: uvc: don't do DMA on stack

BugLink: https://bugs.launchpad.net/bugs/1946802
commit 1a10d7fdb6d0e235e9d230916244cc2769d3f170 upstream.

As warned by smatch:
drivers/media/usb/uvc/uvc_v4l2.c:911 uvc_ioctl_g_input() error: doing dma on the stack (&i)
drivers/media/usb/uvc/uvc_v4l2.c:943 uvc_ioctl_s_input() error: doing dma on the stack (&i)

those two functions call uvc_query_ctrl passing a pointer to
a data at the DMA stack. those are used to send URBs via
usb_control_msg(). Using DMA stack is not supported and should
not work anymore on modern Linux versions.

So, use a kmalloc'ed buffer.

Cc: stable@vger.kernel.org # Kernel 4.9 and upper
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
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: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/media/usb/uvc/uvc_v4l2.c