net: lapbether: handle NETDEV_PRE_TYPE_CHANGE
Subsystems (3)
PATCH v2 1/1 net: lapbether: handle NETDEV_PRE_TYPE_CHANGE
lapbeth_data_transmit() expects the underlying device type to be ARPHRD_ETHER.
Returning NOTIFY_BAD from lapbeth_device_event() makes sure bonding driver can not break this expectation.
---
v2: cache lapbeth_get_x25_dev() result in @lapbeth.
make sure @lapbeth is set before returning NOTIFY_BAD.
drivers/net/wan/lapbether.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/net/wan/lapbether.c +8 -5
@@ -446,33 +446,36 @@ static void lapbeth_free_device(struct lapbethdev *lapbeth)static int lapbeth_device_event (struct notifier_block *this,unsigned long event,void *ptr) { -struct lapbethdev *lapbeth;struct net_device *dev =netdev_notifier_info_to_dev (ptr); +struct lapbethdev *lapbeth;if (dev_net (dev) != &init_net)return NOTIFY_DONE ; -if (!dev_is_ethdev (dev) && !lapbeth_get_x25_dev (dev)) + lapbeth =lapbeth_get_x25_dev (dev); +if (!dev_is_ethdev (dev) && !lapbeth)return NOTIFY_DONE ;switch (event) {case NETDEV_UP :/* New ethernet device -> new LAPB interface */ -if (!lapbeth_get_x25_dev (dev)) +if (!lapbeth)lapbeth_new_device (dev);break ;case NETDEV_GOING_DOWN :/* ethernet device closes -> close LAPB interface */ - lapbeth =lapbeth_get_x25_dev (dev);if (lapbeth)dev_close (lapbeth->axdev);break ;case NETDEV_UNREGISTER :/* ethernet device disappears -> remove LAPB interface */ - lapbeth =lapbeth_get_x25_dev (dev);if (lapbeth)lapbeth_free_device (lapbeth);break ; +case NETDEV_PRE_TYPE_CHANGE : +/* Our underlying device type must not change. */ +if (lapbeth) +return NOTIFY_BAD ; }return NOTIFY_DONE ;
Signature · 1 line
2.53.0.1185.g05d4b7b318-goog
Quoted 12 lines · Eric Dumazet
lapbeth_data_transmit()expects the underlying device type to beARPHRD_ETHER.Returning
NOTIFY_BADfromlapbeth_device_event()makes sure bonding driver can not break this expectation.Fixes 872254dd6b1f ("net/bonding: Enable bonding to enslave non ARPHRD_ETHER")Reported-by [email protected]Signed-off-by Eric Dumazet <[email protected]>Cc Martin Schiller <[email protected]>
Quoted 3 lines
---
v2: cachelapbeth_get_x25_dev()result in @lapbeth.
make sure @lapbeth is set before returningNOTIFY_BAD.
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 6 lines · On Thu, 2 Apr 2026 10:35:19 +0000 you wrote:
lapbeth_data_transmit()expects the underlying device type to beARPHRD_ETHER.Returning
NOTIFY_BADfromlapbeth_device_event()makes sure bonding driver can not break this expectation.
Quoted 8 lines
Fixes 872254dd6b1f ("net/bonding: Enable bonding to enslave non ARPHRD_ETHER")Reported-by [email protected]Signed-off-by Eric Dumazet <[email protected]>Cc Martin Schiller <[email protected]>[...]
Here is the summary with links:
- [v2,net] net: lapbether: handle NETDEV_PRE_TYPE_CHANGE
https://git.kernel.org/netdev/net/c/b120e4432f9f
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html