ipv4: remove unnecessary reset of position pointer

The position pointer is only advanced if the return value of the proc
handler is positive at new_sync_write(). Therefore no need to manually
reset it when doing error handling.

Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Link: https://patch.msgid.link/20260727091834.6645-1-fmancera@suse.de
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Fernando Fernandez Mancera
2026-07-27 11:18:33 +02:00
committed by Paolo Abeni
parent 49b5123182
commit ea771e17e9

View File

@@ -2607,10 +2607,9 @@ static int devinet_conf_proc(const struct ctl_table *ctl, int write,
static int devinet_sysctl_forward(const struct ctl_table *ctl, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{
struct net *net = ctl->extra2;
int *valp = ctl->data;
int val = *valp;
loff_t pos = *ppos;
struct net *net = ctl->extra2;
int ret;
if (write && !ns_capable(net->user_ns, CAP_NET_ADMIN))
@@ -2623,7 +2622,6 @@ static int devinet_sysctl_forward(const struct ctl_table *ctl, int write,
if (!rtnl_net_trylock(net)) {
/* Restore the original values before restarting */
*valp = val;
*ppos = pos;
return restart_syscall();
}
if (valp == &IPV4_DEVCONF_ALL(net, FORWARDING)) {