[Devel] [PATCH hci-8.1] net/ip6_gre: fix a host panic adding ip6gre in a CT without ipgre
no-reply at sashiko.virtuozzo.com
no-reply at sashiko.virtuozzo.com
Wed Nov 4 23:31:02 MSK 2026
> From: Denis V. Lunev <den at openvz.org>
>
> ip6gre_init_net() frees the ip6gre_net of a netns whose VE lacks
> VE_FEATURE_IPGRE, and ip6gre_newlink_common() refuses such a netns with
> -EACCES. ip6gre_newlink() and ip6erspan_newlink() reach the NULL
> ip6gre_net first, through ip6gre_tunnel_find() or collect_md_tun, so
> "ip link add type ip6gre" by root in an ordinary container panics the
> node once ip6_gre is loaded:
>
> BUG: kernel NULL pointer dereference, address: 0000000000000320
> RIP: 0010:ip6gre_tunnel_find+0x46/0xd0 [ip6_gre]
> ip6gre_newlink+0x9b/0x120 [ip6_gre]
>
> The check went into ip6gre_newlink_common(), which ran the tunnel lookup
> until upstream commit b80d0b93b991 ("net: ip6_gre: fix tunnel metadata
> device sharing.") moved the lookup into the newlink handlers. Move the
> check to the top of both handlers. They are the only callers of
> ip6gre_newlink_common() and serve as newlink for all three link types
> (ip6gre, ip6gretap and ip6erspan), and nothing else in the helper uses
> ip6gre_net.
>
> Fixes: 46c13c45f25a ("net/gre: Consider VE_FEATURE_IPGRE on new net creation")
>
> https://virtuozzo.atlassian.net/browse/VSTOR-149645
> Feature: ve: per-CT features management
> Signed-off-by: Denis V. Lunev <den at openvz.org>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261104200755.1956316-1-den@openvz.org?part=1
More information about the Devel
mailing list