1
0
Fork 0
alistair23-linux/drivers/usb/typec/ucsi
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
..
Kconfig USB: add missing SPDX lines to Kconfig and Makefiles 2019-01-22 09:08:17 +01:00
Makefile usb: typec: ucsi: Support for DisplayPort alt mode 2019-04-25 11:04:55 +02:00
displayport.c usb: typec: ucsi: displayport: Fix a potential race during registration 2020-03-25 08:25:51 +01:00
trace.c usb: typec: ucsi: Preliminary support for alternate modes 2019-04-25 11:03:53 +02:00
trace.h usb: typec: ucsi: Preliminary support for alternate modes 2019-04-25 11:03:53 +02:00
ucsi.c usb: typec: ucsi: Prevent mode overrun 2020-09-23 12:40:44 +02:00
ucsi.h usb: typec: ucsi: ccg: enable runtime pm support 2019-06-08 00:09:20 +02:00
ucsi_acpi.c usb: typec: ucsi: acpi: Check the _DEP dependencies 2020-09-17 13:47:56 +02:00
ucsi_ccg.c usb: typec: ucsi: ccg: Remove run_isr flag 2019-10-04 13:51:26 +02:00