mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sven Peter <sven@kernel.org>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: asahi@lists.linux.dev, linux-usb@vger.kernel.org,
	 linux-kernel@vger.kernel.org, Sven Peter <sven@kernel.org>
Subject: [PATCH] usb: typec: tipd: Zero-initialize CD321x partner descriptor
Date: Sun, 06 Sep 2026 14:43:28 +0200	[thread overview]
Message-ID: <20260906-b4-tipd-partner-desc-v1-1-073559f142ff@kernel.org> (raw)

The typec_partner_desc struct isn't initialized and instead filled with
whatever values happen to be on the stack. We especially don't overwrite
the attach/detach callbacks. Just zero initialize it to make sure we don't
run into weird issues in the future.

Fixes: 82432bbfb9e8 ("usb: typec: tipd: Handle mode transitions for CD321x")
Signed-off-by: Sven Peter <sven@kernel.org>
---
I deliberately didn't cc stable@ since we can't even reach the path
that would try to run these callbacks on platforms where this is used.
Just noticed this while working on the USB4/Thunderbolt series for Apple
Silicon.
---
 drivers/usb/typec/tipd/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
index 522f56742aa9..07d6d88e3a0e 100644
--- a/drivers/usb/typec/tipd/core.c
+++ b/drivers/usb/typec/tipd/core.c
@@ -841,7 +841,7 @@ 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 */

---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260906-b4-tipd-partner-desc-07915a127b0a

Best regards,
--  
Sven Peter <sven@kernel.org>



             reply	other threads:[~2026-09-06 12:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-06 12:43 Sven Peter [this message]
2026-09-06 12:56 ` Pandey, Radhey Shyam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260906-b4-tipd-partner-desc-v1-1-073559f142ff@kernel.org \
    --to=sven@kernel.org \
    --cc=asahi@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®