netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Octavian Purdila <tavip@google.com>
Cc: jiri@resnulli.us, andrew+netdev@lunn.ch, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
	syzbot+3c47b5843403a45aef57@syzkaller.appspotmail.com
Subject: Re: [PATCH net-next] team: prevent adding a device which is already a team device lower
Date: Mon, 6 Jan 2025 03:46:16 +0000	[thread overview]
Message-ID: <Z3tSCOJH4fQ99cBe@fedora> (raw)
In-Reply-To: <CAGWr4cQNhd2UQn33F_JJUE5tFrQgRHe0BZs-kGO4cno4uZ6HnA@mail.gmail.com>

On Thu, Jan 02, 2025 at 11:50:25AM -0800, Octavian Purdila wrote:
> > I didn't test, what if enslave veth0 first and then add enslave veth0.1 later.
> >
> 
> Hi Hangbin,
> 
> Thanks for the review!
> 
> I was not able to reproduce the crash with this scenario. I think this
> is because adding veth0.1 does not affect the link state for veth0,
> while in the original scenario bringing up veth0 would also bring up
> veth0.1.
> 
> Regardless, allowing this setup seems risky and syzkaller may find
> other ways to trigger it, so maybe a more generic check like below
> would be better?
> 
>         list_for_each_entry(tmp, &team->port_list, list) {
>                 if (netdev_has_upper_dev(tmp->dev, port_dev) ||
>                         netdev_has_upper_dev(port_dev, tmp->dev)) {
>                         NL_SET_ERR_MSG(extack, "Device is a lower or
> upper of an enslaved device");
>                         netdev_err(dev, "Device %s is a lower or upper
> device of enslaved device %s\n",
>                                    portname, tmp->dev->name);
>                         return -EBUSY;
>                 }
>         }
> 
> Although I am not sure if there are legitimate use-cases that this may restrict?

The logic makes sense to me. Let's see if Jiri has any comments.

Thanks
Hangbin

  reply	other threads:[~2025-01-06  3:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-30 20:56 [PATCH net-next] team: prevent adding a device which is already a team device lower Octavian Purdila
2025-01-02  8:50 ` Hangbin Liu
2025-01-02  8:53   ` Hangbin Liu
2025-01-02 19:50     ` Octavian Purdila
2025-01-06  3:46       ` Hangbin Liu [this message]
2025-01-03 12: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=Z3tSCOJH4fQ99cBe@fedora \
    --to=liuhangbin@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=edumazet@google.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+3c47b5843403a45aef57@syzkaller.appspotmail.com \
    --cc=tavip@google.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;
as well as URLs for NNTP newsgroup(s).