Commit 5449a5ca authored by WANG Cong's avatar WANG Cong Committed by David S. Miller
Browse files

addrconf: always initialize sysctl table data



When sysctl performs restrict writes, it allows to write from
a middle position of a sysctl file, which requires us to initialize
the table data before calling proc_dostring() for the write case.

Fixes: 3d1bec99 ("ipv6: introduce secret_stable to ipv6_devconf")
Reported-by: default avatarSasha Levin <sasha.levin@oracle.com>
Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
Tested-by: default avatarSasha Levin <sasha.levin@oracle.com>
Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 024f35c5
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -5369,14 +5369,11 @@ static int addrconf_sysctl_stable_secret(struct ctl_table *ctl, int write,
		goto out;
	}

	if (!write) {
		err = snprintf(str, sizeof(str), "%pI6",
			       &secret->secret);
	err = snprintf(str, sizeof(str), "%pI6", &secret->secret);
	if (err >= sizeof(str)) {
		err = -EIO;
		goto out;
	}
	}

	err = proc_dostring(&lctl, write, buffer, lenp, ppos);
	if (err || !write)