mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
usb: typec: tipd: fix uninitialized typec_partner_desc in cd321x_update_work()
cd321x_update_work() passes a stack-allocated typec_partner_desc to
typec_register_partner() after initializing only usb_pd, accessory and
identity.
typec_register_partner() copies attach and deattach from the descriptor
into the partner. With those fields left unset, garbage function pointers
may be stored and later invoked from typec_partner_link_device() when a USB
device is linked to the port. Uninitialized pd_revision and usb_capability
similarly leak stack data through partner sysfs.
Zero-initialize the descriptor so optional callbacks remain NULL and the
remaining fields are zero.
Fixes: 82432bbfb9 ("usb: typec: tipd: Handle mode transitions for CD321x")
Cc: stable <stable@kernel.org> # 6.18+
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Link: https://patch.msgid.link/20260906131942.83153-3-radhey.shyam.pandey@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c4b27b3605
commit
88c7e458af
|
|
@ -849,11 +849,10 @@ static void cd321x_update_work(struct work_struct *work)
|
|||
|
||||
/* Set up partner if we were previously disconnected (or changed). */
|
||||
if (!tps->partner) {
|
||||
struct typec_partner_desc desc;
|
||||
struct typec_partner_desc desc = { };
|
||||
|
||||
desc.usb_pd = is_pd;
|
||||
desc.accessory = TYPEC_ACCESSORY_NONE; /* XXX: handle accessories */
|
||||
desc.identity = NULL;
|
||||
|
||||
if (desc.usb_pd)
|
||||
desc.identity = &st.partner_identity;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user