lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 13 Dec 2023 07:49:14 +0200
From:   Mika Westerberg <mika.westerberg@...ux.intel.com>
To:     Sanath S <Sanath.S@....com>
Cc:     mario.limonciello@....com, andreas.noever@...il.com,
        michael.jamet@...el.com, YehezkelShB@...il.com,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [Patch v2 2/2] thunderbolt: Teardown tunnels and reset
 downstream ports created by boot firmware

On Wed, Dec 13, 2023 at 12:46:35AM +0530, Sanath S wrote:
> Boot firmware might have created tunnels of its own. Since we cannot
> be sure they are usable for us. Tear them down and reset the ports
> to handle it as a new hotplug for USB3 routers.
> 
> Suggested-by: Mario Limonciello <mario.limonciello@....com>
> Signed-off-by: Sanath S <Sanath.S@....com>
> ---
>  drivers/thunderbolt/tb.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
> index fd49f86e0353..febd0b6972e3 100644
> --- a/drivers/thunderbolt/tb.c
> +++ b/drivers/thunderbolt/tb.c
> @@ -2598,6 +2598,17 @@ static int tb_start(struct tb *tb)
>  	tb_switch_tmu_enable(tb->root_switch);
>  	/* Full scan to discover devices added before the driver was loaded. */
>  	tb_scan_switch(tb->root_switch);
> +	/*
> +	 * Boot firmware might have created tunnels of its own. Since we cannot
> +	 * be sure they are usable for us, Tear them down and reset the ports
> +	 * to handle it as new hotplug for USB4 routers.
> +	 */
> +	if (tb_switch_is_usb4(tb->root_switch)) {
> +		tb_switch_discover_tunnels(tb->root_switch,
> +					   &tcm->tunnel_list, false);

Why this is needed?

It should be enough, to do simply something like this:

	if (tb_switch_is_usb4(tb->root_switch))
		tb_switch_reset(tb->root_switch);

and continue with the rest of the function. The tb_switch_reset() then
resets the downstream ports synchronously so when it returns there is
nothing to be discover.

(We can use the tb_switch_reset() here, it already exists and is
performing TBT 1 specific things but you can make it handle downstream
port reset in case of USB4).

You don't need to touch the ->hotplug_active or anything else here.

> +		tcm->hotplug_active = true;
> +		return tb_switch_reset_ports(tb->root_switch);
> +	}
>  	/* Find out tunnels created by the boot firmware */
>  	tb_discover_tunnels(tb);
>  	/* Add DP resources from the DP tunnels created by the boot firmware */
> -- 
> 2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ