kernel_samsung_a53x/drivers/usb/gadget
Lee Jones 43347b12e1 usb: gadget: configfs: Prevent OOB read/write in usb_string_copy()
commit 6d3c721e686ea6c59e18289b400cc95c76e927e0 upstream.

Userspace provided string 's' could trivially have the length zero. Left
unchecked this will firstly result in an OOB read in the form
`if (str[0 - 1] == '\n') followed closely by an OOB write in the form
`str[0 - 1] = '\0'`.

There is already a validating check to catch strings that are too long.
Let's supply an additional check for invalid strings that are too short.

Signed-off-by: Lee Jones <lee@kernel.org>
Cc: stable <stable@kernel.org>
Link: https://lore.kernel.org/r/20240705074339.633717-1-lee@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-19 14:19:44 +01:00
..
function usb: gadget: printer: fix races against disable 2024-11-19 14:19:33 +01:00
legacy usb: raw-gadget: properly handle interrupted requests 2024-11-18 10:58:48 +01:00
udc usb: udc: remove warning when queue disabled ep 2024-11-19 09:22:43 +01:00
composite.c usb: gadget: composite: fix OS descriptors w_value logic 2024-11-19 11:32:48 +01:00
config.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
configfs.c usb: gadget: configfs: Prevent OOB read/write in usb_string_copy() 2024-11-19 14:19:44 +01:00
configfs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
epautoconf.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
functions.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
u_f.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
u_f.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
u_os_desc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
usbstring.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00