addrconf: always initialize sysctl table data
Subsystems (3)
PATCH 1/1 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 3d1bec99320d ("ipv6: introduce secret_stable to ipv6_devconf")
Reported-by Sasha Levin <[email protected]>
Tested-by Sasha Levin <[email protected]>
Signed-off-by Cong Wang <[email protected]>
--- net/ipv6/addrconf.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
net/ipv6/addrconf.c +4 -7
@@ -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);
Signature · 1 line
1.8.3.1
David Miller
maintainerFrom: Cong Wang <[email protected]>
Date: Mon, 21 Dec 2015 10:55:45 -0800
Quoted 9 lines
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 3d1bec99320d ("ipv6: introduce secret_stable to ipv6_devconf")Reported-by Sasha Levin <[email protected]>Tested-by Sasha Levin <[email protected]>Signed-off-by Cong Wang <[email protected]>
Applied and queued up for -stable, thanks.