mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
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 <joel.granados@kernel.org> Acked-by: Julian Anastasov <ja@ssi.bg> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
3ba2013728
commit
7f1a04254a
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user