lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221002174430.3065870-1-linux@roeck-us.net>
Date:   Sun,  2 Oct 2022 10:44:30 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Laurent Pinchart <laurent.pinchart@...asonboard.com>
Cc:     Felipe Balbi <balbi@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        Guenter Roeck <linux@...ck-us.net>,
        Michael Grzeschik <m.grzeschik@...gutronix.de>
Subject: [PATCH] usb: gadget: uvc: Fix clearing of vdev

Commit e4ce9ed835bc ("usb: gadget: uvc: ensure the vdev is unset")
introduced code to clear the video device on video device registration.
However, it uses sizeof(uvc->video) instead of sizeof(uvc->vdev) to clear
uvc->vdev. This may result in the following build error.

In function 'fortify_memset_chk',
    inlined from 'uvc_register_video'
    at drivers/usb/gadget/function/f_uvc.c:424:2:
include/linux/fortify-string.h:301:25: error:
	call to '__write_overflow_field' declared with attribute warning:
		detected write beyond size of field

The problem is exposed by commit 9b91a6523078 ("usb: gadget: uvc: increase
worker prio to WQ_HIGHPRI") which increases the size of struct uvc_video.

Fixes: e4ce9ed835bc ("usb: gadget: uvc: ensure the vdev is unset")
Cc: Michael Grzeschik <m.grzeschik@...gutronix.de>
Signed-off-by: Guenter Roeck <linux@...ck-us.net>
---
 drivers/usb/gadget/function/f_uvc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index e6948cf8def3..836601227155 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -421,7 +421,7 @@ uvc_register_video(struct uvc_device *uvc)
 	int ret;
 
 	/* TODO reference counting. */
-	memset(&uvc->vdev, 0, sizeof(uvc->video));
+	memset(&uvc->vdev, 0, sizeof(uvc->vdev));
 	uvc->vdev.v4l2_dev = &uvc->v4l2_dev;
 	uvc->vdev.v4l2_dev->dev = &cdev->gadget->dev;
 	uvc->vdev.fops = &uvc_v4l2_fops;
-- 
2.36.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ