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]
Message-ID: <20260119222004.o62uvpobnmffus2r@skbuf>
Date: Tue, 20 Jan 2026 00:20:04 +0200
From: Vladimir Oltean <olteanv@...il.com>
To: Linus Walleij <linusw@...nel.org>
Cc: Andrew Lunn <andrew@...n.ch>, "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Woojung Huh <woojung.huh@...rochip.com>,
	UNGLinuxDriver@...rochip.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v2 3/4] net: dsa: ks8995: Add stub bridge
 join/leave

On Mon, Jan 19, 2026 at 03:30:07PM +0100, Linus Walleij wrote:
> Implementing ks8995_port_pre_bridge_flags() and
> ks8995_port_bridge_flags() without port_bridge_join()
> is a no-op.
> 
> This adds stubs for bridge join/leave callbacks following
> the pattern of drivers/net/dsa/microchip/ksz_common.c:
> as we have STP callbacks and these will be called right
> after bridge join/leave these will take care of the
> job of setting up the learning which is all we support.
> 
> Fixes: a7fe8b266f65 ("net: dsa: ks8995: Add basic switch set-up")
> Reported-by: Vladimir Oltean <olteanv@...il.com>
> Signed-off-by: Linus Walleij <linusw@...nel.org>
> ---
>  drivers/net/dsa/ks8995.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/net/dsa/ks8995.c b/drivers/net/dsa/ks8995.c
> index 5ad62fa4e52c..060bc8303a14 100644
> --- a/drivers/net/dsa/ks8995.c
> +++ b/drivers/net/dsa/ks8995.c
> @@ -461,6 +461,26 @@ static void ks8995_port_disable(struct dsa_switch *ds, int port)
>  	dev_dbg(ks->dev, "disable port %d\n", port);
>  }
>  
> +static int ks8995_port_bridge_join(struct dsa_switch *ds, int port,
> +				   struct dsa_bridge bridge,
> +				   bool *tx_fwd_offload,
> +				   struct netlink_ext_ack *extack)
> +{
> +	/* port_stp_state_set() will be called after to put the port in
> +	 * appropriate state so there is no need to do anything.
> +	 */

Not directly related, but reviewing ks8995_port_stp_state_set() I
noticed another issue: the driver implementation of the
BR_STATE_LEARNING and BR_STATE_FORWARDING states should take into
consideration a previous call to ks8995_port_bridge_flags() which has
disabled BR_LEARNING for the port.

Look at ksz_port_stp_state_set() to compare how it first tests for
p->learning before touching PORT_LEARN_DISABLE.

This becomes a problem with this patch, because this patch brings
ks8995_port_bridge_flags() to life and makes user space able to turn off
address learning for the port. So it is relevant, and it would be good
to fix it before enabling the feature.

And yet one more potential issue: standalone user ports should have
address learning disabled. At driver probe time it is the driver's
responsibility to ensure that this is the case. After the port joins a
bridge and leaves it afterwards, the setting changes are driven by DSA.
I don't know what the default setting is in your case.

> +
> +	return 0;
> +}
> +
> +static void ks8995_port_bridge_leave(struct dsa_switch *ds, int port,
> +				     struct dsa_bridge bridge)
> +{
> +	/* port_stp_state_set() will be called after to put the port in
> +	 * forwarding state so there is no need to do anything.
> +	 */
> +}
> +
>  static int ks8995_port_pre_bridge_flags(struct dsa_switch *ds, int port,
>  					struct switchdev_brport_flags flags,
>  					struct netlink_ext_ack *extack)
> @@ -635,6 +655,8 @@ static int ks8995_get_max_mtu(struct dsa_switch *ds, int port)
>  static const struct dsa_switch_ops ks8995_ds_ops = {
>  	.get_tag_protocol = ks8995_get_tag_protocol,
>  	.setup = ks8995_setup,
> +	.port_bridge_join = ks8995_port_bridge_join,
> +	.port_bridge_leave = ks8995_port_bridge_leave,
>  	.port_pre_bridge_flags = ks8995_port_pre_bridge_flags,
>  	.port_bridge_flags = ks8995_port_bridge_flags,
>  	.port_enable = ks8995_port_enable,
> 
> -- 
> 2.52.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ