* [PATCH v2 net] ipvlan: inherit needed_headroom and needed_tailroom from phy_dev
@ 2026-08-06 10:38 Eric Dumazet
2026-08-07 6:23 ` Hangbin Liu
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2026-08-06 10:38 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: Simon Horman, netdev, eric.dumazet, Eric Dumazet,
syzbot+1f9fd0f4b601cf88d6e6, Tangxin Xie
ipvlan devices inherit hard_header_len from phy_dev during ipvlan_init(),
but leave needed_headroom and needed_tailroom set to 0.
When the underlying phy_dev (or stacked lower device) requires extra headroom
or tailroom for headers/trailers (e.g. macsec, ipsec, wireguard, tunnels, or
veth with rx headroom), upper layers calculating packet headroom and tailroom
fail to reserve sufficient space.
This can result in reallocation overhead, skb headroom underflows, or KASAN
slab-use-after-free crashes when dev_hard_header() / ipvlan_hard_header()
prepends header data or when lower devices append tailroom.
Fix this by:
1. Inheriting needed_headroom and needed_tailroom from phy_dev in ipvlan_init().
2. Propagating needed_headroom and needed_tailroom updates to attached ipvlans
in ipvlan_device_event() when receiving NETDEV_FEAT_CHANGE events.
Fixes: 2ad7bfab3016 ("ipvlan: Initial check-in of the IPVLAN driver.")
Reported-by: syzbot+1f9fd0f4b601cf88d6e6@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/netdev/6a720a21.40259c87.584f4.04bb.GAE@google.com/T/#u
Reported-by: Tangxin Xie <xietangxin@h-partners.com>
Closes: https://lore.kernel.org/netdev/CANn89i+1EW-sFNK8xoq98gMbPCeLS7e=+rs9gHfLg5Wj+4x0sw@mail.gmail.com/T/#mcc6307f115e500df23ea2980d5669fe95f20b6b4
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
v2: also inherit needed_tailroom (Sashiko)
v1: https://lore.kernel.org/netdev/CANn89iLr4EQxBAKikZCeXbXEk-pjmT4mq3d=D2P01MtNSUgwrg@mail.gmail.com/T/#t
drivers/net/ipvlan/ipvlan_main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index ed46439a9f4eb1dd8bfaf6c83476ba4f2aff31bc..92d3d340281ffbc8e54a61e975484ab156c42c9b 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -146,6 +146,8 @@ static int ipvlan_init(struct net_device *dev)
dev->lltx = true;
netif_inherit_tso_max(dev, phy_dev);
dev->hard_header_len = phy_dev->hard_header_len;
+ dev->needed_headroom = phy_dev->needed_headroom;
+ dev->needed_tailroom = phy_dev->needed_tailroom;
netdev_lockdep_set_classes(dev);
@@ -773,6 +775,8 @@ static int ipvlan_device_event(struct notifier_block *unused,
case NETDEV_FEAT_CHANGE:
list_for_each_entry(ipvlan, &port->ipvlans, pnode) {
netif_inherit_tso_max(ipvlan->dev, dev);
+ ipvlan->dev->needed_headroom = dev->needed_headroom;
+ ipvlan->dev->needed_tailroom = dev->needed_tailroom;
netdev_update_features(ipvlan->dev);
}
break;
--
2.55.0.629.g250fe7f194-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 net] ipvlan: inherit needed_headroom and needed_tailroom from phy_dev
2026-08-06 10:38 [PATCH v2 net] ipvlan: inherit needed_headroom and needed_tailroom from phy_dev Eric Dumazet
@ 2026-08-07 6:23 ` Hangbin Liu
0 siblings, 0 replies; 2+ messages in thread
From: Hangbin Liu @ 2026-08-07 6:23 UTC (permalink / raw)
To: Eric Dumazet
Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Simon Horman,
netdev, eric.dumazet, syzbot+1f9fd0f4b601cf88d6e6, Tangxin Xie
On 06.08.2026 10:38, Eric Dumazet wrote:
>ipvlan devices inherit hard_header_len from phy_dev during ipvlan_init(),
>but leave needed_headroom and needed_tailroom set to 0.
>
>When the underlying phy_dev (or stacked lower device) requires extra headroom
>or tailroom for headers/trailers (e.g. macsec, ipsec, wireguard, tunnels, or
>veth with rx headroom), upper layers calculating packet headroom and tailroom
>fail to reserve sufficient space.
>
>This can result in reallocation overhead, skb headroom underflows, or KASAN
>slab-use-after-free crashes when dev_hard_header() / ipvlan_hard_header()
>prepends header data or when lower devices append tailroom.
>
>Fix this by:
>1. Inheriting needed_headroom and needed_tailroom from phy_dev in ipvlan_init().
>2. Propagating needed_headroom and needed_tailroom updates to attached ipvlans
> in ipvlan_device_event() when receiving NETDEV_FEAT_CHANGE events.
>
>Fixes: 2ad7bfab3016 ("ipvlan: Initial check-in of the IPVLAN driver.")
>Reported-by: syzbot+1f9fd0f4b601cf88d6e6@syzkaller.appspotmail.com
>Closes: https://lore.kernel.org/netdev/6a720a21.40259c87.584f4.04bb.GAE@google.com/T/#u
>Reported-by: Tangxin Xie <xietangxin@h-partners.com>
>Closes: https://lore.kernel.org/netdev/CANn89i+1EW-sFNK8xoq98gMbPCeLS7e=+rs9gHfLg5Wj+4x0sw@mail.gmail.com/T/#mcc6307f115e500df23ea2980d5669fe95f20b6b4
>Signed-off-by: Eric Dumazet <edumazet@google.com>
>---
>v2: also inherit needed_tailroom (Sashiko)
>v1: https://lore.kernel.org/netdev/CANn89iLr4EQxBAKikZCeXbXEk-pjmT4mq3d=D2P01MtNSUgwrg@mail.gmail.com/T/#t
>
> drivers/net/ipvlan/ipvlan_main.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
>diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
>index ed46439a9f4eb1dd8bfaf6c83476ba4f2aff31bc..92d3d340281ffbc8e54a61e975484ab156c42c9b 100644
>--- a/drivers/net/ipvlan/ipvlan_main.c
>+++ b/drivers/net/ipvlan/ipvlan_main.c
>@@ -146,6 +146,8 @@ static int ipvlan_init(struct net_device *dev)
> dev->lltx = true;
> netif_inherit_tso_max(dev, phy_dev);
> dev->hard_header_len = phy_dev->hard_header_len;
>+ dev->needed_headroom = phy_dev->needed_headroom;
>+ dev->needed_tailroom = phy_dev->needed_tailroom;
>
> netdev_lockdep_set_classes(dev);
>
>@@ -773,6 +775,8 @@ static int ipvlan_device_event(struct notifier_block *unused,
> case NETDEV_FEAT_CHANGE:
> list_for_each_entry(ipvlan, &port->ipvlans, pnode) {
> netif_inherit_tso_max(ipvlan->dev, dev);
>+ ipvlan->dev->needed_headroom = dev->needed_headroom;
>+ ipvlan->dev->needed_tailroom = dev->needed_tailroom;
> netdev_update_features(ipvlan->dev);
> }
> break;
>--
>2.55.0.629.g250fe7f194-goog
>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-07 6:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-06 10:38 [PATCH v2 net] ipvlan: inherit needed_headroom and needed_tailroom from phy_dev Eric Dumazet
2026-08-07 6:23 ` Hangbin Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox