From 7f1a04254a05e14845ff3d377931f941f62e41d5 Mon Sep 17 00:00:00 2001 From: Joel Granados Date: Tue, 22 Sep 2026 11:08:13 +0200 Subject: [PATCH] ipvs: skip committing sync_threshold when proc_dointvec fails Forward rc value and skip updating sysctl_sync_threshold when proc_dointvec fails. This targets a write such as "5 x" which would fail with -EINVAL but would store the first element anyway. Signed-off-by: Joel Granados Acked-by: Julian Anastasov Signed-off-by: Pablo Neira Ayuso --- net/netfilter/ipvs/ip_vs_ctl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 3003547dcabe..ce9fe20d6106 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c @@ -2452,6 +2452,8 @@ proc_do_sync_threshold(const struct ctl_table *table, int write, mutex_lock(&ipvs->sync_mutex); memcpy(val, valp, sizeof(val)); rc = proc_dointvec(&tmp, write, buffer, lenp, ppos); + if (rc) + goto out; if (write) { if (val[0] < 0 || val[1] < 0 || (val[0] >= val[1] && val[1])) @@ -2459,6 +2461,7 @@ proc_do_sync_threshold(const struct ctl_table *table, int write, else memcpy(valp, val, sizeof(val)); } +out: mutex_unlock(&ipvs->sync_mutex); return rc; }