提交 5449a5ca 编写于 作者: W WANG Cong 提交者: 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: NSasha Levin <sasha.levin@oracle.com>
Acked-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
Tested-by: NSasha Levin <sasha.levin@oracle.com>
Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 024f35c5
...@@ -5369,14 +5369,11 @@ static int addrconf_sysctl_stable_secret(struct ctl_table *ctl, int write, ...@@ -5369,14 +5369,11 @@ static int addrconf_sysctl_stable_secret(struct ctl_table *ctl, int write,
goto out; goto out;
} }
if (!write) { err = snprintf(str, sizeof(str), "%pI6", &secret->secret);
err = snprintf(str, sizeof(str), "%pI6",
&secret->secret);
if (err >= sizeof(str)) { if (err >= sizeof(str)) {
err = -EIO; err = -EIO;
goto out; goto out;
} }
}
err = proc_dostring(&lctl, write, buffer, lenp, ppos); err = proc_dostring(&lctl, write, buffer, lenp, ppos);
if (err || !write) if (err || !write)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册