linux/drivers/usb/typec
Badhri Jagan Sridharan 08bd1be1c7 usb: typec: altmodes/displayport: fix pin_assignment_show
commit d8f28269dd upstream.

This patch fixes negative indexing of buf array in pin_assignment_show
when get_current_pin_assignments returns 0 i.e. no compatible pin
assignments are found.

BUG: KASAN: use-after-free in pin_assignment_show+0x26c/0x33c
...
Call trace:
dump_backtrace+0x110/0x204
dump_stack_lvl+0x84/0xbc
print_report+0x358/0x974
kasan_report+0x9c/0xfc
__do_kernel_fault+0xd4/0x2d4
do_bad_area+0x48/0x168
do_tag_check_fault+0x24/0x38
do_mem_abort+0x6c/0x14c
el1_abort+0x44/0x68
el1h_64_sync_handler+0x64/0xa4
el1h_64_sync+0x78/0x7c
pin_assignment_show+0x26c/0x33c
dev_attr_show+0x50/0xc0

Fixes: 0e3bb7d689 ("usb: typec: Add driver for DisplayPort alternate mode")
Cc: stable@vger.kernel.org
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20230508214443.893436-1-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2023-05-24 17:32:48 +01:00
..
altmodes usb: typec: altmodes/displayport: fix pin_assignment_show 2023-05-24 17:32:48 +01:00
mux usb: typec: intel_pmc_mux: Don't leak the ACPI device reference count 2023-03-10 09:33:31 +01:00
tcpm usb: typec: tcpm: fix multiple times discover svids error 2023-05-24 17:32:41 +01:00
tipd usb: typec: tipd: Fix typec_unregister_port error paths 2022-12-31 13:32:39 +01:00
ucsi usb: typec: ucsi: acpi: add quirk for ASUS Zenbook UM325 2023-05-24 17:32:40 +01:00
anx7411.c USB/Thunderbolt changes for 6.1-rc1 2022-10-07 16:48:26 -07:00
bus.c usb: typec: Check for ops->exit instead of ops->enter in altmode_exit 2022-12-31 13:32:39 +01:00
bus.h usb: typec: Organize the private headers properly 2021-04-05 09:07:41 +02:00
class.c usb: typec: Remove retimers properly 2022-08-30 15:30:39 +02:00
class.h usb: typec: Add retimer handle to port 2022-07-14 16:24:05 +02:00
hd3ss3220.c i2c: Make remove callback return void 2022-08-16 12:46:26 +02:00
Kconfig usb: typec: anx7411: Fix build error without CONFIG_POWER_SUPPLY 2022-09-22 15:21:03 +02:00
Makefile usb: typec: Add support for retimers 2022-07-14 16:24:05 +02:00
mux.c usb: typec: Replace custom implementation of device_match_fwnode() 2022-09-30 13:55:13 +02:00
mux.h usb: typec: mux: Introduce indirection 2022-04-26 13:47:13 +02:00
pd.c usb: typec: pd: Remove usb_suspend_supported sysfs from sink PDO 2023-03-03 11:52:24 +01:00
pd.h usb: typec: Separate USB Power Delivery from USB Type-C 2022-06-12 06:49:47 +02:00
port-mapper.c ACPI: bus: Introduce acpi_bus_for_each_dev() 2022-03-02 20:55:47 +01:00
qcom-pmic-typec.c usb: typec: qcom-pmic-typec: Switch to use dev_err_probe() helper 2022-09-27 10:35:46 +02:00
retimer.c usb: typec: Replace custom implementation of device_match_fwnode() 2022-09-30 13:55:13 +02:00
retimer.h usb: typec: Add support for retimers 2022-07-14 16:24:05 +02:00
rt1719.c i2c: Make remove callback return void 2022-08-16 12:46:26 +02:00
stusb160x.c USB/Thunderbolt changes for 6.1-rc1 2022-10-07 16:48:26 -07:00
wusb3801.c usb: typec: wusb3801: fix fwnode refcount leak in wusb3801_probe() 2022-12-31 13:32:42 +01:00