mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Romain Gantois <romain.gantois@bootlin.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, Alan Stern <stern@rowland.harvard.edu>,
	linux-kernel@vger.kernel.org, Josef Bacik <josef@toxicpanda.com>,
	stable <stable@kernel.org>,
	Griffin Kroah-Hartman <griffin@kroah.com>,
	Oliver Neukum <oneukum@suse.com>, Johan Hovold <johan@kernel.org>,
	Valentina Manea <valentina.manea.m@gmail.com>,
	Shuah Khan <shuah@kernel.org>, Hongren Zheng <i@zenithal.me>,
	Peter Chen <peter.chen@kernel.org>,
	Pawel Laszczak <pawell@cadence.com>,
	Roger Quadros <rogerq@kernel.org>,
	Neill Kapron <nkapron@google.com>, Ijae Kim <ae878000@gmail.com>,
	Herve Codina <herve.codina@bootlin.com>,
	Justin Chen <justin.chen@broadcom.com>,
	Al Cooper <alcooperx@gmail.com>,
	Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	Xu Yang <xu.yang_2@nxp.com>, Frank Li <Frank.Li@nxp.com>,
	Elad Nachman <enachman@marvell.com>,
	Badhri Jagan Sridharan <badhri@google.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Benson Leung <bleung@chromium.org>,
	Romain Gantois <romain.gantois@bootlin.com>,
	Rui Miguel Silva <rui.silva@linaro.org>,
	Minas Harutyunyan <hminas@synopsys.com>
Subject: Re: [PATCH 00/19] USB: a bunch of llm-found fixes
Date: Mon,  2 Nov 2026 10:04:16 +0100	[thread overview]
Message-ID: <20261102090416.12865-1-romain.gantois@bootlin.com> (raw)
In-Reply-To: <20261027-llm-usb-v1-0-b9751ddb9c7c@linuxfoundation.org>

On Tuesday, 27 October 2026 15:57:55 CET Greg Kroah-Hartman wrote:
> From: Josef Bacik <josef@toxicpanda.com>
> 
> typec_set_mode() passes a state without an alternate mode, and the USB
> and accessory modes (TYPEC_MODE_USB2 ... TYPEC_MODE_DEBUG) start at
> TYPEC_STATE_MODAL like the states of the alternate modes. TCPM and UCSI
> set TYPEC_MODE_AUDIO or TYPEC_MODE_DEBUG when such an accessory is
> attached. tusb1046_mux_set() then reads state->alt->svid: plugging in an
> analog audio adapter is a NULL pointer dereference.
> 
> The numbers must not reach the switch either: TYPEC_MODE_AUDIO has the
> value of TYPEC_DP_STATE_D. Without an alternate mode connect the
> SuperSpeed lanes for TYPEC_MODE_USB3 and disconnect them for the rest.
> 
> Fixes: 7c561b8c3e83 ("usb: typec: mux: Add support for the TUSB1046
> crosspoint switch") Cc: stable <stable@kernel.org>
> Cc: Romain Gantois <romain.gantois@bootlin.com>
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/usb/typec/mux/tusb1046.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/typec/mux/tusb1046.c
> b/drivers/usb/typec/mux/tusb1046.c index 34ef81f75693..a463ba5f53be 100644
> --- a/drivers/usb/typec/mux/tusb1046.c
> +++ b/drivers/usb/typec/mux/tusb1046.c
> @@ -43,11 +43,17 @@ static int tusb1046_mux_set(struct typec_mux_dev *mux,
>  	struct tusb1046_priv *priv = typec_mux_get_drvdata(mux);
>  	struct i2c_client *client = priv->client;
>  	struct device *dev = &client->dev;
> +	unsigned long req = state->mode;
>  	int mode, val, ret = 0;
> 
> -	if (state->mode >= TYPEC_STATE_MODAL &&
> -	    state->alt->svid != USB_TYPEC_DP_SID)
> -		return -EINVAL;
> +	if (req >= TYPEC_STATE_MODAL) {
> +		/* USB and accessory modes: not the DP pin assignments */
> +		if (!state->alt)
> +			req = req == TYPEC_MODE_USB3 ? TYPEC_STATE_USB :
> +						       TYPEC_STATE_SAFE;
> +		else if (state->alt->svid != USB_TYPEC_DP_SID)
> +			return -EINVAL;
> +	}
> 
>  	dev_dbg(dev, "mux mode requested: %lu\n", state->mode);
> 
> @@ -60,7 +66,7 @@ static int tusb1046_mux_set(struct typec_mux_dev *mux,
>  		goto out_unlock;
>  	}
> 
> -	switch (state->mode) {
> +	switch (req) {
>  	case TYPEC_STATE_USB:
>  		mode = TUSB1046_CTLSEL_USB3;
>  		break;

Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>

  parent reply	other threads:[~2026-11-02  9:04 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 14:57 Greg Kroah-Hartman
2026-10-27 14:57 ` [PATCH 01/19] usb: core: sysfs: take the port lock to read the BOS Greg Kroah-Hartman
2026-10-27 14:57 ` [PATCH 02/19] USB: core: signal the end of an sg request last Greg Kroah-Hartman
2026-10-27 14:57 ` [PATCH 03/19] usbip: vudc: free the unlink item if the send fails Greg Kroah-Hartman
2026-10-27 14:57 ` [PATCH 04/19] usb: host: oxu210hp-hcd: fix oxu_qh_alloc() deadlock Greg Kroah-Hartman
2026-10-27 14:57 ` [PATCH 05/19] usb: cdns3: switch the role unlocked on resume Greg Kroah-Hartman
2026-10-27 14:57 ` [PATCH 06/19] usb: gadget: snps_udc_plat: lock out the interrupt Greg Kroah-Hartman
2026-10-27 18:17   ` Herve Codina
2026-10-27 14:57 ` [PATCH 07/19] usb: gadget: bdc: the resume callback is optional Greg Kroah-Hartman
2026-10-27 14:57 ` [PATCH 08/19] usb: gadget: uvc: fix oops on a premature STREAMON Greg Kroah-Hartman
2026-10-27 14:57 ` [PATCH 09/19] usb: gadget: f_fs: let the request keep its fence Greg Kroah-Hartman
2026-10-27 14:57 ` [PATCH 10/19] usb: host: ehci-orion: fix the probe without DT Greg Kroah-Hartman
2026-10-27 14:57 ` [PATCH 11/19] usb: typec: tcpm: don't wait for the VDM discovery work Greg Kroah-Hartman
2026-10-27 14:57 ` [PATCH 12/19] usb: typec: tcpci: don't act on unread alerts Greg Kroah-Hartman
2026-11-02 22:23   ` Amit Sunil Dhamne
2026-10-27 14:57 ` [PATCH 13/19] usb: typec: anx7411: zero on-stack alt mode descriptors Greg Kroah-Hartman
2026-10-28 16:20   ` Benson Leung
2026-10-27 14:57 ` [PATCH 14/19] usb: typec: mux: it5205: fix oops on accessory modes Greg Kroah-Hartman
2026-10-27 14:57 ` [PATCH 15/19] usb: typec: mux: tusb1046: " Greg Kroah-Hartman
2026-10-27 14:57 ` [PATCH 16/19] usb: renesas_usbhs: link URBs with interrupts disabled Greg Kroah-Hartman
2026-10-27 14:57 ` [PATCH 17/19] usb: renesas_usbhs: unlink the URB if it is not queued Greg Kroah-Hartman
2026-10-27 14:57 ` [PATCH 18/19] usb: isp1760: wait for the TT clear in endpoint_disable Greg Kroah-Hartman
2026-10-27 15:21   ` Rui Miguel Silva
2026-10-27 14:57 ` [PATCH 19/19] usb: dwc2: " Greg Kroah-Hartman
2026-11-02  9:04 ` Romain Gantois [this message]
2026-11-02  9:07   ` [PATCH 00/19] USB: a bunch of llm-found fixes Romain Gantois
2026-11-02  9:06 ` Romain Gantois

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=20261102090416.12865-1-romain.gantois@bootlin.com \
    --to=romain.gantois@bootlin.com \
    --cc=Frank.Li@nxp.com \
    --cc=ae878000@gmail.com \
    --cc=alcooperx@gmail.com \
    --cc=badhri@google.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bleung@chromium.org \
    --cc=enachman@marvell.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=griffin@kroah.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=herve.codina@bootlin.com \
    --cc=hminas@synopsys.com \
    --cc=i@zenithal.me \
    --cc=johan@kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=justin.chen@broadcom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nkapron@google.com \
    --cc=oneukum@suse.com \
    --cc=pawell@cadence.com \
    --cc=peter.chen@kernel.org \
    --cc=rogerq@kernel.org \
    --cc=rui.silva@linaro.org \
    --cc=shuah@kernel.org \
    --cc=stable@kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=valentina.manea.m@gmail.com \
    --cc=xu.yang_2@nxp.com \
    /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®