linux/drivers/usb
Thinh Nguyen c9e72352a1 usb: dwc3: gadget: Fix looping of queued SG entries
commit b7fc65f514 upstream.

The dwc3_request->num_queued_sgs is decremented on completion. If a
partially completed request is handled, then the
dwc3_request->num_queued_sgs no longer reflects the total number of
num_queued_sgs (it would be cleared).

Correctly check the number of request SG entries remained to be prepare
and queued. Failure to do this may cause null pointer dereference when
accessing non-existent SG entry.

Cc: stable@vger.kernel.org
Fixes: c96e6725db ("usb: dwc3: gadget: Correct the logic for queuing sgs")
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/d07a7c4aa0fcf746cdca0515150dbe5c52000af7.1731545781.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2024-12-14 19:54:05 +01:00
..
atm usb: atm: cxacru: fix endpoint checking in cxacru_bind() 2024-07-05 09:31:55 +02:00
c67x00 USB: c67x00: remove unnecessary check of res 2022-05-12 11:36:46 +02:00
cdns3 usb: xhci: fix loss of data on Cadence xHC 2024-10-17 15:21:25 +02:00
chipidea usb: chipidea: udc: enable suspend interrupt after usb reset 2024-10-17 15:22:16 +02:00
class USB: class: CDC-ACM: fix race between get_serial and set_serial 2024-10-17 15:21:19 +02:00
common usb: ulpi: Fix debugfs directory leak 2024-02-23 09:12:34 +01:00
core usb: core: sysfs: Unmerge @usb3_hardware_lpm_attr_group in remove_power_attributes() 2024-09-04 13:25:04 +02:00
dwc2 usb: dwc2: Adjust the timing of USB Driver Interrupt Registration in the Crashkernel Scenario 2024-10-17 15:22:16 +02:00
dwc3 usb: dwc3: gadget: Fix looping of queued SG entries 2024-12-14 19:54:05 +01:00
early usb: early: xhci-dbc: Fix a potential out-of-bound memory access 2023-03-10 09:33:35 +01:00
gadget Revert "usb: gadget: composite: fix OS descriptors w_value logic" 2024-12-14 19:54:01 +01:00
host usb: xhci: Fix TD invalidation under pending Set TR Dequeue 2024-12-14 19:54:00 +01:00
image usb/image: fix repeated words in comments 2022-07-27 14:33:53 +02:00
isp1760 usb: isp1760: Fix out-of-bounds array access 2022-05-19 18:10:59 +02:00
misc USB: chaoskey: Fix possible deadlock chaoskey_list_lock 2024-12-14 19:53:53 +01:00
mon usb: mon: Fix atomicity violation in mon_bin_vma_fault 2024-01-25 15:27:40 -08:00
mtu3 usb: mtu3: fix kernel panic at qmu transfer done irq handler 2023-05-11 23:03:30 +09:00
musb usb: musb: Fix hardware lockup on first Rx endpoint request 2024-12-14 19:54:05 +01:00
phy usb: phy: Fix API devm_usb_put_phy() can not release the phy 2024-11-08 16:26:44 +01:00
renesas_usbhs usb: renesas: Fix refcount leak bug 2022-06-21 16:39:03 +02:00
roles usb: roles: don't get/set_role() when usb_role_switch is unregistered 2024-03-01 13:26:34 +01:00
serial USB: serial: option: add Quectel RG650V 2024-11-14 13:15:18 +01:00
storage usb: storage: ignore bogus device raised by JieLi BR21 USB sound chip 2024-10-17 15:22:25 +02:00
typec mfd: intel_soc_pmic_bxtwc: Use IRQ domain for USB Type-C device 2024-12-14 19:53:35 +01:00
usbip usbip: Don't submit special requests twice 2024-09-08 07:53:10 +02:00
Kconfig usb: remove reference to deleted config STB03xxx 2021-08-18 15:32:19 +02:00
Makefile USB: xen-hcd: Traverse host/ when CONFIG_USB_XEN_HCD is selected 2024-06-21 14:35:43 +02:00
usb-skeleton.c usb: usb-skeleton: Update min() to min_t() 2021-10-05 12:56:48 +02:00