mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Kalpesh Solanki <skalpesh942@gmail.com>,
	Jay Vosburgh <jv@jvosburgh.net>,
	netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Jiale Yao <yaojiale02@163.com>
Subject: Re: [PATCH] bonding: reject IEEE 802.15.4 and 6LoWPAN devices in bond_enslave
Date: Thu, 12 Nov 2026 14:32:41 +0100	[thread overview]
Message-ID: <9e202895-ff3a-41ab-9bd9-96568561ebc6@hartkopp.net> (raw)
In-Reply-To: <20261112130833.233208-1-skalpesh942@gmail.com>

Hi Kalpesh,

many thanks for picking this up!

On 12.11.26 14:08, Kalpesh Solanki wrote:
> When the first non-Ethernet slave is enslaved to a bond,
> bond_setup_by_slave() copies slave_dev->type to the bond device.
> However, the bonding driver does not set up subsystem-specific
> mid-layer contexts or private structures:
> 
> 1. IEEE 802.15.4 routines (such as ieee802154_llsec_dump_table(),
>     nl-phy.c, and socket callbacks) identify WPAN devices by dev->type
>     alone and unconditionally dereference dev->ieee802154_ptr and
>     dev->ml_priv (ieee802154_mlme_ops). Because bonding never allocates
>     these, this results in a NULL pointer dereference.
> 
> 2. The 6LoWPAN netdevice notifier (lowpan_event()) identifies devices
>     by dev->type == ARPHRD_6LOWPAN and treats netdev_priv(dev) as
>     struct lowpan_dev. On a bond master, netdev_priv() is struct bonding,
>     so writes to lowpan_dev(dev)->ctx.table flags on events like
>     NETDEV_DOWN corrupt the bonding driver's private state.
> 
> The team driver closed an identical gap in commit 9043be310c6a ("team:
> reject CAN, IEEE 802.15.4 and 6LoWPAN devices in team_port_add"). Bonding
> previously only blocked CAN devices in commit 8ba68464e478 ("bonding:
> refuse to enslave CAN devices").

You could have referenced the bonding-splats from my patch:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9043be310c6a4c5e57f7bba4b9870554eac7aa96

So it is not only that this problem has been found by manual code 
inspection.

> Reject ARPHRD_IEEE802154, ARPHRD_IEEE802154_MONITOR, and ARPHRD_6LOWPAN
> devices in bond_enslave().
> 
> Fixes: 8ba68464e478 ("bonding: refuse to enslave CAN devices")
> Signed-off-by: Kalpesh Solanki <skalpesh942@gmail.com>

Reviewed-by: Oliver Hartkopp <socketcan@hartkopp.net>

Best regards,
Oliver

> ---
>   drivers/net/bonding/bond_main.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 7019e5d8fdc..b3b003e39b2 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1894,9 +1894,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
>   	struct sockaddr_storage ss;
>   	int res = 0, i;
>   
> -	if (slave_dev->type == ARPHRD_CAN) {
> +	if (slave_dev->type == ARPHRD_CAN ||
> +	    slave_dev->type == ARPHRD_IEEE802154 ||
> +	    slave_dev->type == ARPHRD_IEEE802154_MONITOR ||
> +	    slave_dev->type == ARPHRD_6LOWPAN) {
>   		BOND_NL_ERR(bond_dev, extack,
> -			    "CAN devices cannot be enslaved");
> +			    "CAN, IEEE 802.15.4 and 6LoWPAN devices cannot be enslaved");
>   		return -EPERM;
>   	}
>   


      parent reply	other threads:[~2026-11-12 13:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 13:08 Kalpesh Solanki
2026-11-12 13:10 ` netdev-bot+sinfo
2026-11-12 13:20   ` KALPESH SOLANKI
2026-11-12 13:32 ` Oliver Hartkopp [this message]

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=9e202895-ff3a-41ab-9bd9-96568561ebc6@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=jv@jvosburgh.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=skalpesh942@gmail.com \
    --cc=yaojiale02@163.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®