mbox series

[net,v3,0/3] bonding: properly restore flags when bond changes ether type

Message ID 20230315111842.1589296-1-razor@blackwall.org (mailing list archive)
Headers show
Series bonding: properly restore flags when bond changes ether type | expand

Message

Nikolay Aleksandrov March 15, 2023, 11:18 a.m. UTC
Hi,
A bug was reported by syzbot[1] that causes a warning and a myriad of
other potential issues if a bond, that is also a slave, fails to enslave a
non-eth device. While fixing that bug I found that we have the same
issues when such enslave passes and after that the bond changes back to
ARPHRD_ETHER (again due to ether_setup). This set fixes all issues by
extracting the ether_setup() sequence in a helper which does the right
thing about bond flags when it needs to change back to ARPHRD_ETHER. It
also adds selftests for these cases.

Patch 01 adds the new bond_ether_setup helper and fixes the issues when a
bond device changes its ether type due to successful enslave. Patch 02
fixes the issues when it changes its ether type due to an unsuccessful
enslave. Note we need two patches because the bugs were introduced by
different commits. Patch 03 adds the new selftests.

Due to the comment adjustment and squash, could you please review
patch 01 again? I've kept the other acks since there were no code
changes.

v3: squash the helper patch and the first fix, adjust the comment above
    it to be explicit about the bond device, no code changes
v2: new set, all patches are new due to new approach of fixing these bugs

Thanks,
 Nik

[1] https://syzkaller.appspot.com/bug?id=391c7b1f6522182899efba27d891f1743e8eb3ef

Nikolay Aleksandrov (3):
  bonding: restore IFF_MASTER/SLAVE flags on bond enslave ether type
    change
  bonding: restore bond's IFF_SLAVE flag if a non-eth dev enslave fails
  selftests: bonding: add tests for ether type changes

 drivers/net/bonding/bond_main.c               | 23 +++--
 .../selftests/drivers/net/bonding/Makefile    |  3 +-
 .../net/bonding/bond-eth-type-change.sh       | 85 +++++++++++++++++++
 3 files changed, 103 insertions(+), 8 deletions(-)
 create mode 100755 tools/testing/selftests/drivers/net/bonding/bond-eth-type-change.sh

Comments

Jonathan Toppins March 15, 2023, 2:44 p.m. UTC | #1
On 3/15/23 07:18, Nikolay Aleksandrov wrote:
> Hi,
> A bug was reported by syzbot[1] that causes a warning and a myriad of
> other potential issues if a bond, that is also a slave, fails to enslave a
> non-eth device. While fixing that bug I found that we have the same
> issues when such enslave passes and after that the bond changes back to
> ARPHRD_ETHER (again due to ether_setup). This set fixes all issues by
> extracting the ether_setup() sequence in a helper which does the right
> thing about bond flags when it needs to change back to ARPHRD_ETHER. It
> also adds selftests for these cases.
> 
> Patch 01 adds the new bond_ether_setup helper and fixes the issues when a
> bond device changes its ether type due to successful enslave. Patch 02
> fixes the issues when it changes its ether type due to an unsuccessful
> enslave. Note we need two patches because the bugs were introduced by
> different commits. Patch 03 adds the new selftests.
> 
> Due to the comment adjustment and squash, could you please review
> patch 01 again? I've kept the other acks since there were no code
> changes.
> 
> v3: squash the helper patch and the first fix, adjust the comment above
>      it to be explicit about the bond device, no code changes
> v2: new set, all patches are new due to new approach of fixing these bugs
> 
> Thanks,
>   Nik
> 
> [1] https://syzkaller.appspot.com/bug?id=391c7b1f6522182899efba27d891f1743e8eb3ef
> 
> Nikolay Aleksandrov (3):
>    bonding: restore IFF_MASTER/SLAVE flags on bond enslave ether type
>      change
>    bonding: restore bond's IFF_SLAVE flag if a non-eth dev enslave fails
>    selftests: bonding: add tests for ether type changes
> 
>   drivers/net/bonding/bond_main.c               | 23 +++--
>   .../selftests/drivers/net/bonding/Makefile    |  3 +-
>   .../net/bonding/bond-eth-type-change.sh       | 85 +++++++++++++++++++
>   3 files changed, 103 insertions(+), 8 deletions(-)
>   create mode 100755 tools/testing/selftests/drivers/net/bonding/bond-eth-type-change.sh
> 

    For the series.
Acked-by: Jonathan Toppins <jtoppins@redhat.com>
Michal Kubiak March 15, 2023, 2:57 p.m. UTC | #2
On Wed, Mar 15, 2023 at 01:18:39PM +0200, Nikolay Aleksandrov wrote:
> Hi,
> A bug was reported by syzbot[1] that causes a warning and a myriad of
> other potential issues if a bond, that is also a slave, fails to enslave a
> non-eth device. While fixing that bug I found that we have the same
> issues when such enslave passes and after that the bond changes back to
> ARPHRD_ETHER (again due to ether_setup). This set fixes all issues by
> extracting the ether_setup() sequence in a helper which does the right
> thing about bond flags when it needs to change back to ARPHRD_ETHER. It
> also adds selftests for these cases.
> 
> Patch 01 adds the new bond_ether_setup helper and fixes the issues when a
> bond device changes its ether type due to successful enslave. Patch 02
> fixes the issues when it changes its ether type due to an unsuccessful
> enslave. Note we need two patches because the bugs were introduced by
> different commits. Patch 03 adds the new selftests.
> 
> Due to the comment adjustment and squash, could you please review
> patch 01 again? I've kept the other acks since there were no code
> changes.
> 
> v3: squash the helper patch and the first fix, adjust the comment above
>     it to be explicit about the bond device, no code changes
> v2: new set, all patches are new due to new approach of fixing these bugs
> 
> Thanks,
>  Nik
> 
> [1] https://syzkaller.appspot.com/bug?id=391c7b1f6522182899efba27d891f1743e8eb3ef
> 
> Nikolay Aleksandrov (3):
>   bonding: restore IFF_MASTER/SLAVE flags on bond enslave ether type
>     change
>   bonding: restore bond's IFF_SLAVE flag if a non-eth dev enslave fails
>   selftests: bonding: add tests for ether type changes
> 
>  drivers/net/bonding/bond_main.c               | 23 +++--
>  .../selftests/drivers/net/bonding/Makefile    |  3 +-
>  .../net/bonding/bond-eth-type-change.sh       | 85 +++++++++++++++++++
>  3 files changed, 103 insertions(+), 8 deletions(-)
>  create mode 100755 tools/testing/selftests/drivers/net/bonding/bond-eth-type-change.sh
> 


For the series.
Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>

Thanks,
Michal

> -- 
> 2.39.1
>
patchwork-bot+netdevbpf@kernel.org March 17, 2023, 8 a.m. UTC | #3
Hello:

This series was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Wed, 15 Mar 2023 13:18:39 +0200 you wrote:
> Hi,
> A bug was reported by syzbot[1] that causes a warning and a myriad of
> other potential issues if a bond, that is also a slave, fails to enslave a
> non-eth device. While fixing that bug I found that we have the same
> issues when such enslave passes and after that the bond changes back to
> ARPHRD_ETHER (again due to ether_setup). This set fixes all issues by
> extracting the ether_setup() sequence in a helper which does the right
> thing about bond flags when it needs to change back to ARPHRD_ETHER. It
> also adds selftests for these cases.
> 
> [...]

Here is the summary with links:
  - [net,v3,1/3] bonding: restore IFF_MASTER/SLAVE flags on bond enslave ether type change
    https://git.kernel.org/netdev/net/c/9ec7eb60dcbc
  - [net,v3,2/3] bonding: restore bond's IFF_SLAVE flag if a non-eth dev enslave fails
    https://git.kernel.org/netdev/net/c/e667d4690986
  - [net,v3,3/3] selftests: bonding: add tests for ether type changes
    https://git.kernel.org/netdev/net/c/222c94ec0ad4

You are awesome, thank you!