android_kernel_xiaomi_sm8450/drivers/usb
Lee Jones 5a64f75761 UPSTREAM: 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.

Bug: 346754046
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>
(cherry picked from commit d1205033e912f9332c1dbefa812e6ceb0575ce0a)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Id9a34f3e5495aef0d2a800a1386210f4d9fa8116
2024-07-22 16:27:30 +01:00
..
atm
c67x00
cdns3 usb: cdns3: fix memory double free when handle zero packet 2024-03-01 13:16:49 +01:00
chipidea usb: chipidea: wait controller resume finished for wakeup irq 2024-01-25 14:37:51 -08:00
class Revert "usb: cdc-wdm: close race between read and workqueue" 2024-05-02 16:23:39 +02:00
common Merge 5.10.191 into android12-5.10-lts 2023-08-28 16:37:52 +00:00
core Merge 5.10.217 into android12-5.10-lts 2024-06-14 13:21:33 +00:00
dwc2 Merge 5.10.216 into android12-5.10-lts 2024-06-13 16:02:17 +00:00
dwc3 Merge 5.10.217 into android12-5.10-lts 2024-06-14 13:21:33 +00:00
early
gadget UPSTREAM: usb: gadget: configfs: Prevent OOB read/write in usb_string_copy() 2024-07-22 16:27:30 +01:00
host Merge 5.10.217 into android12-5.10-lts 2024-06-14 13:21:33 +00:00
image
isp1760
misc USB: sisusbvga: Add endpoint checks 2023-05-30 12:57:57 +01:00
mon usb: mon: Fix atomicity violation in mon_bin_vma_fault 2024-01-25 14:37:52 -08:00
mtu3 usb: mtu3: fix kernel panic at qmu transfer done irq handler 2023-05-17 11:47:58 +02:00
musb usb: musb: Modify the "HWVers" register address 2023-10-25 11:54:15 +02:00
phy Revert "usb: phy: generic: Get the vbus supply" 2024-04-13 12:59:30 +02:00
renesas_usbhs
roles Revert "usb: roles: fix NULL pointer issue when put module's reference" 2024-04-29 09:30:10 +00:00
serial USB: serial: option: add Telit FN920C04 rmnet compositions 2024-05-02 16:23:39 +02:00
storage USB: usb-storage: Prevent divide-by-0 error in isd200_ata_command 2024-04-13 12:58:50 +02:00
typec Merge 5.10.218 into android12-5.10-lts 2024-06-14 13:35:36 +00:00
usbip kcov: Remove kcov include from sched.h and move it to its users. 2024-05-17 11:48:07 +02:00
Kconfig
Makefile
usb-skeleton.c