mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ipvs: skip committing sync_threshold when proc_dointvec fails
@ 2026-09-22  9:08 Joel Granados
  2026-09-22 16:52 ` Julian Anastasov
  0 siblings, 1 reply; 2+ messages in thread
From: Joel Granados @ 2026-09-22  9:08 UTC (permalink / raw)
  To: Simon Horman, Julian Anastasov, Pablo Neira Ayuso,
	Florian Westphal, Phil Sutter, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, netdev, lvs-devel, netfilter-devel, coreteam,
	linux-kernel, Joel Granados

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 <joel.granados@kernel.org>
---
 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 4c1c739446b76ea455dab2958a844d05e31a46a7..7c260529238cd2015f1d30abd094d25b056b30fa 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -2454,6 +2454,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]))
@@ -2461,6 +2463,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;
 }

---
base-commit: 93f51579e7df248780214094418f205253383cc5
change-id: 20260922-lklm-sysctl-retval-fix-abad29dc37bd

Best regards,
-- 
Joel Granados <joel.granados@kernel.org>



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ipvs: skip committing sync_threshold when proc_dointvec fails
  2026-09-22  9:08 [PATCH] ipvs: skip committing sync_threshold when proc_dointvec fails Joel Granados
@ 2026-09-22 16:52 ` Julian Anastasov
  0 siblings, 0 replies; 2+ messages in thread
From: Julian Anastasov @ 2026-09-22 16:52 UTC (permalink / raw)
  To: Joel Granados
  Cc: Simon Horman, Pablo Neira Ayuso, Florian Westphal, Phil Sutter,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, netdev, lvs-devel, netfilter-devel, coreteam,
	linux-kernel


	Hello,

On Tue, 22 Sep 2026, Joel Granados wrote:

> 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 <joel.granados@kernel.org>

	Looks good to me for the nf tree, thanks!

Acked-by: Julian Anastasov <ja@ssi.bg>

> ---
>  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 4c1c739446b76ea455dab2958a844d05e31a46a7..7c260529238cd2015f1d30abd094d25b056b30fa 100644
> --- a/net/netfilter/ipvs/ip_vs_ctl.c
> +++ b/net/netfilter/ipvs/ip_vs_ctl.c
> @@ -2454,6 +2454,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]))
> @@ -2461,6 +2463,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;
>  }
> 
> ---
> base-commit: 93f51579e7df248780214094418f205253383cc5
> change-id: 20260922-lklm-sysctl-retval-fix-abad29dc37bd
> 
> Best regards,
> -- 
> Joel Granados <joel.granados@kernel.org>

Regards

--
Julian Anastasov <ja@ssi.bg>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-22 16:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-22  9:08 [PATCH] ipvs: skip committing sync_threshold when proc_dointvec fails Joel Granados
2026-09-22 16:52 ` Julian Anastasov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®