linux/drivers/usb/typec
Badhri Jagan Sridharan fc0e18f95c 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:36:53 +01:00
..
altmodes usb: typec: altmodes/displayport: fix pin_assignment_show 2023-05-24 17:36:53 +01:00
mux usb: typec: intel_pmc_mux: Don't leak the ACPI device reference count 2023-03-10 09:39:37 +01:00
tcpm usb: typec: tcpm: fix multiple times discover svids error 2023-05-24 17:36:47 +01:00
tipd usb: typec: tipd: Fix spurious fwnode_handle_put in error path 2022-12-31 13:14:27 +01:00
ucsi usb: ucsi: Fix NULL pointer deref in ucsi_connector_change() 2023-03-30 12:47:57 +02:00
bus.c usb: typec: Check for ops->exit instead of ops->enter in altmode_exit 2022-12-31 13:14:27 +01:00
bus.h usb: typec: Organize the private headers properly 2021-04-05 09:07:41 +02:00
class.c usb: typec: Factor out non-PD fwnode properties 2022-12-31 13:14:28 +01:00
class.h usb: typec: Link all ports during connector registration 2021-04-09 16:00:00 +02:00
hd3ss3220.c usb: typec: hd3ss3220: Use OF graph API to get the connector fwnode 2020-10-02 15:28:18 +02:00
Kconfig usb: typec: STUSB160X should select REGMAP_I2C 2021-11-18 19:16:54 +01:00
Makefile usb: typec: Port mapping utility 2021-04-09 16:00:00 +02:00
mux.c usb: typec: mux: Check dev_set_name() return value 2022-06-14 18:36:05 +02:00
mux.h usb: typec: mux: Use device type instead of device name for matching 2021-05-27 09:23:57 +02:00
port-mapper.c usb: typec: silence a static checker warning 2021-04-14 15:15:40 +02:00
qcom-pmic-typec.c usb: typec: Add QCOM PMIC typec detection driver 2020-10-09 15:14:43 +02:00
stusb160x.c usb: typec: stusb160x: Don't block probing of consumer of "connector" nodes 2021-07-21 09:16:40 +02:00