Skip to content

Commit 9f8c863

Browse files
committed
Merge: ipv6: use RCU protection in ip6_default_advmss()
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/581 JIRA: https://issues.redhat.com/browse/RHEL-81574 Upstream Status: linux.git CVE: CVE-2025-21765 Signed-off-by: Guillaume Nault <gnault@redhat.com> Approved-by: Antoine Tenart <atenart@redhat.com> Approved-by: Florian Westphal <fwestpha@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Julio Faracco <jfaracco@redhat.com>
2 parents 6a829a3 + a855ddb commit 9f8c863

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

include/linux/netdevice.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2577,6 +2577,12 @@ struct net *dev_net(const struct net_device *dev)
25772577
return read_pnet(&dev->nd_net);
25782578
}
25792579

2580+
static inline
2581+
struct net *dev_net_rcu(const struct net_device *dev)
2582+
{
2583+
return read_pnet_rcu(&dev->nd_net);
2584+
}
2585+
25802586
static inline
25812587
void dev_net_set(struct net_device *dev, struct net *net)
25822588
{

include/net/net_namespace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ static inline struct net *read_pnet(const possible_net_t *pnet)
392392
#endif
393393
}
394394

395-
static inline struct net *read_pnet_rcu(possible_net_t *pnet)
395+
static inline struct net *read_pnet_rcu(const possible_net_t *pnet)
396396
{
397397
#ifdef CONFIG_NET_NS
398398
return rcu_dereference(pnet->net);

net/ipv6/route.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3196,13 +3196,18 @@ static unsigned int ip6_default_advmss(const struct dst_entry *dst)
31963196
{
31973197
struct net_device *dev = dst->dev;
31983198
unsigned int mtu = dst_mtu(dst);
3199-
struct net *net = dev_net(dev);
3199+
struct net *net;
32003200

32013201
mtu -= sizeof(struct ipv6hdr) + sizeof(struct tcphdr);
32023202

3203+
rcu_read_lock();
3204+
3205+
net = dev_net_rcu(dev);
32033206
if (mtu < net->ipv6.sysctl.ip6_rt_min_advmss)
32043207
mtu = net->ipv6.sysctl.ip6_rt_min_advmss;
32053208

3209+
rcu_read_unlock();
3210+
32063211
/*
32073212
* Maximal non-jumbo IPv6 payload is IPV6_MAXPLEN and
32083213
* corresponding MSS is IPV6_MAXPLEN - tcp_header_size.

0 commit comments

Comments
 (0)