All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jay Vosburgh <jay.vosburgh@canonical.com>
To: Hangbin Liu <liuhangbin@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Andy Gospodarek <andy@greyhouse.net>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com,
	syzbot <syzkaller@googlegroups.com>
Subject: Re: [PATCH net] bonding: stop the device in bond_setup_by_slave()
Date: Fri, 10 Nov 2023 11:19:22 +0200	[thread overview]
Message-ID: <84246.1699607962@vermin> (raw)
In-Reply-To: <ZU2nBgeOAZVs4KKJ@Laptop-X1>

Hangbin Liu <liuhangbin@gmail.com> wrote:

>On Thu, Nov 09, 2023 at 06:01:02PM +0000, Eric Dumazet wrote:
>> Commit 9eed321cde22 ("net: lapbether: only support ethernet devices")
>> has been able to keep syzbot away from net/lapb, until today.
>> 
>> In the following splat [1], the issue is that a lapbether device has
>> been created on a bonding device without members. Then adding a non
>> ARPHRD_ETHER member forced the bonding master to change its type.
>> 
>> The fix is to make sure we call dev_close() in bond_setup_by_slave()
>> so that the potential linked lapbether devices (or any other devices
>> having assumptions on the physical device) are removed.
>> 
>> A similar bug has been addressed in commit 40baec225765
>> ("bonding: fix panic on non-ARPHRD_ETHER enslave failure")
>> 
>
>Do we need also do this if the bond changed to ether device from other dev
>type? e.g.
>
>    if (slave_dev->type != ARPHRD_ETHER)
>            bond_setup_by_slave(bond_dev, slave_dev);
>    else
>            bond_ether_setup(bond_dev);

	I'm not sure I follow your comment; bond_enslave() already has
the above logic.  If the bond is not ARPHRD_ETHER and an ARPHRD_ETHER
device is added to the bond, the above will take the bond_ether_setup()
path, which will call ether_setup() which will set the device to
ARPHRD_ETHER.

	However, my recollection is that the bond device itself should
be unregistered if the last interface of a non-ARPHRD_ETHER bond is
removed.  This dates back to d90a162a4ee2 ("net/bonding: Destroy bonding
master when last slave is gone"), but I don't know if the logic still
works correctly (I've not heard much about IPoIB with bonding in a
while).  The bond cannot be initially created as non-ARPHRD_ETHER; the
type changes when the first such interface is added to the bond.

	-J

---
	-Jay Vosburgh, jay.vosburgh@canonical.com

  parent reply	other threads:[~2023-11-10  9:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09 18:01 [PATCH net] bonding: stop the device in bond_setup_by_slave() Eric Dumazet
2023-11-09 20:26 ` Jay Vosburgh
2023-11-10  3:44 ` Hangbin Liu
2023-11-10  8:38   ` Eric Dumazet
2023-11-11  6:28     ` Hangbin Liu
2023-11-10  9:19   ` Jay Vosburgh [this message]
2023-11-11  6:34     ` Hangbin Liu
2023-11-14  0:43       ` Jay Vosburgh
2023-11-14  1:30 ` Hangbin Liu
2023-11-14  5:00 ` patchwork-bot+netdevbpf

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=84246.1699607962@vermin \
    --to=jay.vosburgh@canonical.com \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=liuhangbin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzkaller@googlegroups.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.