Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: Check CHANGEUPPER notifier return value

switchdev drivers reflect the newly requested topology to hardware when
CHANGEUPPER is received, after software links were already formed.
However, the operation can fail and user will not be notified, as the
return value of the notifier is not checked.

Add this check and rollback software links if necessary.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ido Schimmel and committed by
David S. Miller
b03804e7 3b195843

+6 -2
+6 -2
net/core/dev.c
··· 5490 5490 goto rollback_lower_mesh; 5491 5491 } 5492 5492 5493 - call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev, 5494 - &changeupper_info.info); 5493 + ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev, 5494 + &changeupper_info.info); 5495 + ret = notifier_to_errno(ret); 5496 + if (ret) 5497 + goto rollback_lower_mesh; 5498 + 5495 5499 return 0; 5496 5500 5497 5501 rollback_lower_mesh: