]> git.baikalelectronics.ru Git - kernel.git/commit
usb: typec: ucsi: Only check the contract if there is a connection
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>
Tue, 21 Dec 2021 14:03:52 +0000 (17:03 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Dec 2021 15:30:53 +0000 (16:30 +0100)
commitb60d3a98dfdd9fa9e672b766fb1227efa7c71c73
tree231b9cba0f3c6b43b78d814fd0c43da97ec53851
parentc1a19d1680905c503aad35fa25d2ebbb98d04d38
usb: typec: ucsi: Only check the contract if there is a connection

The driver must make sure there is an actual connection
before checking details about the USB Power Delivery
contract. Those details are not valid unless there is a
connection.

This fixes NULL pointer dereference that is caused by an
attempt to register bogus partner alternate mode that the
firmware on some platform may report before the actual
connection.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=215117
Fixes: 3d28095b931c ("usb: typec: ucsi: Check the partner alt modes always if there is PD contract")
Reported-by: Chris Hixon <linux-kernel-bugs@hixontech.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/eb34f98f-00ef-3238-2daa-80481116035d@leemhuis.info/
Link: https://lore.kernel.org/r/20211221140352.45501-1-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/ucsi/ucsi.c