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

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
......@@ -5369,13 +5369,10 @@ static int addrconf_sysctl_stable_secret(struct ctl_table *ctl, int write,
goto out;
}
if (!write) {
err = snprintf(str, sizeof(str), "%pI6",
&secret->secret);
if (err >= sizeof(str)) {
err = -EIO;
goto out;
}
err = snprintf(str, sizeof(str), "%pI6", &secret->secret);
if (err >= sizeof(str)) {
err = -EIO;
goto out;
}
err = proc_dostring(&lctl, write, buffer, lenp, ppos);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment