1
0
Fork 0
alistair23-linux/drivers/usb/typec
Heikki Krogerus 7c96edc6e7 usb: typec: ucsi: Prevent mode overrun
commit 386e15a650 upstream.

Sometimes the embedded controller firmware does not
terminate the list of alternate modes that the partner
supports in its response to the GET_ALTERNATE_MODES command.
Instead the firmware returns the supported alternate modes
over and over again until the driver stops requesting them.

If that happens, the number of modes for each alternate mode
will exceed the maximum 6 that is defined in the USB Power
Delivery specification. Making sure that can't happen by
adding a check for it.

This fixes NULL pointer dereference that is caused by the
overrun.

Fixes: ad74b8649b ("usb: typec: ucsi: Preliminary support for alternate modes")
Cc: stable@vger.kernel.org
Reported-by: Zwane Mwaikambo <zwanem@gmail.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20200916090034.25119-3-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-23 12:40:44 +02:00
..
altmodes usb: typec: Add driver for NVIDIA Alt Modes 2019-04-25 11:04:56 +02:00
mux usb: typec: Registering real device entries for the muxes 2019-06-03 10:55:38 +02:00
tcpm usb: typec: tcpci_rt1711h: avoid screaming irq causing boot hangs 2020-06-30 15:36:49 -04:00
ucsi usb: typec: ucsi: Prevent mode overrun 2020-09-23 12:40:44 +02:00
Kconfig usb: typec: tps6598x: Fix build error without CONFIG_REGMAP_I2C 2019-09-03 15:46:46 +02:00
Makefile usb: typec: Group all TCPCI/TCPM code together 2018-09-20 13:37:29 +02:00
bus.c usb: typec: altmode: Fix typec_altmode_get_partner sometimes returning an invalid pointer 2020-04-29 16:33:23 +02:00
bus.h usb: typec: Registering real device entries for the muxes 2019-06-03 10:55:38 +02:00
class.c usb: typec: fix use after free in typec_register_port() 2019-12-17 19:56:00 +01:00
mux.c usb: typec: mux: Switch to use fwnode_property_count_uXX() 2019-07-25 11:07:42 +02:00
tps6598x.c drivers/usb/typec/tps6598x.c: fix 4CC cmd write 2019-07-03 18:40:49 +02:00