Commit 44db3952 authored by WANG Cong's avatar WANG Cong Committed by Kamal Mostafa

addrconf: always initialize sysctl table data

commit 5449a5ca upstream.

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>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent fdff6970
......@@ -5269,13 +5269,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