From c62d1c6185a0dff7623aabfc16c77e6834ceaf5b Mon Sep 17 00:00:00 2001 From: Aditya Pakki Date: Fri, 30 Apr 2021 16:42:36 +0800 Subject: [PATCH] ipv6/route: Add a missing check on proc_dointvec mainline inclusion from mainline-v5.0-rc1 commit f0fb9b288d0a7e9cc324ae362e2dfd2cc2217ded category: bugfix bugzilla: 51403 CVE: NA ------------------------------------------------- While flushing the cache via ipv6_sysctl_rtcache_flush(), the call to proc_dointvec() may fail. The fix adds a check that returns the error, on failure. Signed-off-by: Aditya Pakki Signed-off-by: David S. Miller Signed-off-by: Xu Jia Reviewed-by: Yue Haibing Signed-off-by: Yang Yingliang --- net/ipv6/route.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 84be9b42819c..74f948a28a5e 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -5145,12 +5145,16 @@ int ipv6_sysctl_rtcache_flush(struct ctl_table *ctl, int write, { struct net *net; int delay; + int ret; if (!write) return -EINVAL; net = (struct net *)ctl->extra1; delay = net->ipv6.sysctl.flush_delay; - proc_dointvec(ctl, write, buffer, lenp, ppos); + ret = proc_dointvec(ctl, write, buffer, lenp, ppos); + if (ret) + return ret; + fib6_run_gc(delay <= 0 ? 0 : (unsigned long)delay, net, delay > 0); return 0; } -- GitLab