From: Thomas Martitz <t.martitz@fritz.com>
To: Simon Horman <horms@kernel.org>
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND 1/1] macvlan: allow source mode devices along with passthru
Date: Thu, 9 Jul 2026 10:49:36 +0200 [thread overview]
Message-ID: <4ffe7fe8-fdbb-42a1-b2b1-d11a351b2e16@fritz.com> (raw)
In-Reply-To: <20260708164350.1513604-1-horms@kernel.org>
Hi Simon,
Am 08.07.26 um 18:43 schrieb Simon Horman:
> This is an AI-generated review of your patch. The human sending this
> email has considered the AI review valid, or at least plausible.
> Full review at: https://sashiko.dev
Thanks for feedback. The remarks are valid, I agree. I also begin to better
understand the macvlan code so I'm a bit more confident now about which of
the existing "macvlan_passthru" checks need treatment. I'll send an updated
patch.
General question though: The initial posting triggered an AI review (I see
that now, I didn't know about https://sashiko.dev before). But it did not
trigger an email. Can you explain why? Because I accidentally dropped the RFC
tag from the mail subject?
Best regards.
> ---
> macvlan: allow source mode devices along with passthru
>
> This allows for configurations where there are a few
> known senders in the system (e.g. multiple SoCs on the same
> board) along with unlimited external senders.
>
>> diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
>> index c40fa331836bb..d28f9d905a84d 100644
>> --- a/drivers/net/macvlan.c
>> +++ b/drivers/net/macvlan.c
>
> [ ... ]
>
>> @@ -1523,10 +1514,30 @@ int macvlan_common_newlink(struct net_device *dev,
>> if (data && data[IFLA_MACVLAN_FLAGS])
>> vlan->flags = nla_get_u16(data[IFLA_MACVLAN_FLAGS]);
>>
>> + /* Only 1 macvlan device can be created in passthru mode. There may be
>> + * additional source mode devices but nothing else at the moment.
>> + *
>> + * First check if adding a source mode device to an existing passthru vlan.
>> + */
>> + if (macvlan_passthru(port) && vlan->mode != MACVLAN_MODE_SOURCE) {
>> + /* The macvlan port must be not created this time,
>> + * still goto destroy_macvlan_port for readability.
>> + */
>> + err = -EINVAL;
>> + goto destroy_macvlan_port;
>> + }
>
> [Severity: High]
> While macvlan_common_newlink() prevents creating non-SOURCE devices on a
> passthru port, macvlan_changelink() does not seem to have a similar check.
>
> Can a user bypass this restriction by creating a SOURCE device and then using
> changelink to modify its mode to VEPA, bypassing MAC isolation?
>
> [Severity: High]
> With source devices and passthru devices now coexisting on the same port,
> functions like macvlan_open(), macvlan_stop(), and macvlan_sync_address()
> check the port-wide macvlan_passthru(vlan->port) flag instead of the device
> mode.
>
> If a user brings down a SOURCE device on a passthru port, will macvlan_stop()
> incorrectly take the passthru teardown path? This appears to skip dev_uc_del()
> and call dev_set_promiscuity(..., -1) for a device that never incremented it.
>
>> +
>> + /* Now check if adding a passthru device to an existing set of source mode
>> + * devices.
>> + */
>> if (vlan->mode == MACVLAN_MODE_PASSTHRU) {
>> - if (port->count) {
>> - err = -EINVAL;
>> - goto destroy_macvlan_port;
>> + struct macvlan_dev *p;
>> +
>> + list_for_each_entry(p, &port->vlans, list) {
>> + if (p->mode != MACVLAN_MODE_SOURCE) {
>> + err = -EINVAL;
>> + goto destroy_macvlan_port;
>> + }
>> }
>> macvlan_set_passthru(port);
>
> [Severity: High]
> If a PASSTHRU device is deleted while SOURCE devices still exist on the port,
> macvlan_uninit() decrements port->count but does not clear MACVLAN_F_PASSTHRU.
>
> Does this leave the port in a permanently broken state where new PASSTHRU
> devices cannot be created, and remaining SOURCE devices continue to be
> mistakenly treated as passthru?
>
>> eth_hw_addr_inherit(dev, lowerdev);
>
--
Thomas Martitz <t.martitz@fritz.com>
FRITZ! Technology GmbH, Berlin (Germany)
next prev parent reply other threads:[~2026-07-09 8:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 9:23 [PATCH RFC 0/1] macvlan: allow source mode devices along with passthru Thomas Martitz
2026-06-12 9:23 ` [PATCH RFC 1/1] " Thomas Martitz
2026-07-02 6:56 ` [PATCH RESEND RFC 0/1] " Thomas Martitz
2026-07-02 6:56 ` [PATCH RESEND 1/1] " Thomas Martitz
2026-07-08 16:43 ` Simon Horman
2026-07-09 8:49 ` Thomas Martitz [this message]
2026-07-09 15:18 ` Simon Horman
2026-07-09 9:11 ` [PATCH v2 0/1] " Thomas Martitz
2026-07-09 9:11 ` [PATCH v2 1/1] " Thomas Martitz
2026-07-10 7:48 ` [syzbot ci] " syzbot ci
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=4ffe7fe8-fdbb-42a1-b2b1-d11a351b2e16@fritz.com \
--to=t.martitz@fritz.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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