Blob Blame History Raw
From: Michal Kubecek <mkubecek@suse.cz>
Date: Mon, 4 Mar 2024 23:58:19 +0100
Subject: kabi: restore return type of dst_ops::gc() callback
Patch-mainline: Never, kabi workaround
References: CVE-2023-52340 bsc#1219295

Backport of mainline commit af6d10345ca7 ("ipv6: remove max_size check
inline with ipv4") changes return type of gc() callback in struct dst_ops
from int to void. Restore it back to int and make the function always
return 0 to work around the kABI breakage while preserving the behaviour
introduced by the fix.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
---
 include/net/dst_ops.h | 2 +-
 net/ipv6/route.c      | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

--- a/include/net/dst_ops.h
+++ b/include/net/dst_ops.h
@@ -15,7 +15,7 @@ struct dst_ops {
 	unsigned short		family;
 	unsigned int		gc_thresh;
 
-	void			(*gc)(struct dst_ops *ops);
+	int			(*gc)(struct dst_ops *ops);
 	struct dst_entry *	(*check)(struct dst_entry *, __u32 cookie);
 	unsigned int		(*default_advmss)(const struct dst_entry *);
 	unsigned int		(*mtu)(const struct dst_entry *);
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -85,7 +85,7 @@ static struct dst_entry *ip6_negative_advice(struct dst_entry *);
 static void		ip6_dst_destroy(struct dst_entry *);
 static void		ip6_dst_ifdown(struct dst_entry *,
 				       struct net_device *dev, int how);
-static void		 ip6_dst_gc(struct dst_ops *ops);
+static int		 ip6_dst_gc(struct dst_ops *ops);
 
 static int		ip6_pkt_discard(struct sk_buff *skb);
 static int		ip6_pkt_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb);
@@ -1701,7 +1701,7 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
 	return dst;
 }
 
-static void ip6_dst_gc(struct dst_ops *ops)
+static int ip6_dst_gc(struct dst_ops *ops)
 {
 	struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops);
 	int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval;
@@ -1721,6 +1721,7 @@ static void ip6_dst_gc(struct dst_ops *ops)
 		net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1;
 out:
 	net->ipv6.ip6_rt_gc_expire -= net->ipv6.ip6_rt_gc_expire>>rt_elasticity;
+	return 0;
 }
 
 static int ip6_convert_metrics(struct mx6_config *mxc,