summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRD Babiera <rdbabiera@google.com>2023-08-14 18:05:59 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-09-23 11:00:01 +0200
commit5f71716772b88cbe0e1788f6a38d7871aff2120b (patch)
treeb587a0ea24a857ba82a984d097579472b2f02101 /include
parent14fe0f8627f8fec4aa927a6be19e8c3599a038e8 (diff)
downloadlinux-5f71716772b88cbe0e1788f6a38d7871aff2120b.tar.gz
linux-5f71716772b88cbe0e1788f6a38d7871aff2120b.tar.bz2
linux-5f71716772b88cbe0e1788f6a38d7871aff2120b.zip
usb: typec: bus: verify partner exists in typec_altmode_attention
[ Upstream commit f23643306430f86e2f413ee2b986e0773e79da31 ] Some usb hubs will negotiate DisplayPort Alt mode with the device but will then negotiate a data role swap after entering the alt mode. The data role swap causes the device to unregister all alt modes, however the usb hub will still send Attention messages even after failing to reregister the Alt Mode. type_altmode_attention currently does not verify whether or not a device's altmode partner exists, which results in a NULL pointer error when dereferencing the typec_altmode and typec_altmode_ops belonging to the altmode partner. Verify the presence of a device's altmode partner before sending the Attention message to the Alt Mode driver. Fixes: 8a37d87d72f0 ("usb: typec: Bus type for alternate modes") Cc: stable@vger.kernel.org Signed-off-by: RD Babiera <rdbabiera@google.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20230814180559.923475-1-rdbabiera@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/usb/typec_altmode.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/usb/typec_altmode.h b/include/linux/usb/typec_altmode.h
index 9a88c74a1d0d..969b7c504087 100644
--- a/include/linux/usb/typec_altmode.h
+++ b/include/linux/usb/typec_altmode.h
@@ -67,7 +67,7 @@ struct typec_altmode_ops {
int typec_altmode_enter(struct typec_altmode *altmode);
int typec_altmode_exit(struct typec_altmode *altmode);
-void typec_altmode_attention(struct typec_altmode *altmode, u32 vdo);
+int typec_altmode_attention(struct typec_altmode *altmode, u32 vdo);
int typec_altmode_vdm(struct typec_altmode *altmode,
const u32 header, const u32 *vdo, int count);
int typec_altmode_notify(struct typec_altmode *altmode, unsigned long conf,