]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb: typec: altmodes/displayport: create sysfs nodes as driver's default device attri...
authorRD Babiera <rdbabiera@google.com>
Thu, 29 Feb 2024 00:11:02 +0000 (00:11 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:28:42 +0000 (15:28 +0200)
commit4a22aeac24d0d5f26ba741408e8b5a4be6dc5dc0
tree006c1762716e1dca1539e64ef988e05d64704fe1
parent871fd7b10b56d280990b7e754f43d888382ca325
usb: typec: altmodes/displayport: create sysfs nodes as driver's default device attribute group

commit 165376f6b23e9a779850e750fb2eb06622e5a531 upstream.

The DisplayPort driver's sysfs nodes may be present to the userspace before
typec_altmode_set_drvdata() completes in dp_altmode_probe. This means that
a sysfs read can trigger a NULL pointer error by deferencing dp->hpd in
hpd_show or dp->lock in pin_assignment_show, as dev_get_drvdata() returns
NULL in those cases.

Remove manual sysfs node creation in favor of adding attribute group as
default for devices bound to the driver. The ATTRIBUTE_GROUPS() macro is
not used here otherwise the path to the sysfs nodes is no longer compliant
with the ABI.

Fixes: 0e3bb7d6894d ("usb: typec: Add driver for DisplayPort alternate mode")
Cc: stable@vger.kernel.org
Signed-off-by: RD Babiera <rdbabiera@google.com>
Link: https://lore.kernel.org/r/20240229001101.3889432-2-rdbabiera@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/altmodes/displayport.c