* [Patch net] addrconf: always initialize sysctl table data
@ 2015-12-21 18:55 Cong Wang
2015-12-22 22:01 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Cong Wang @ 2015-12-21 18:55 UTC (permalink / raw)
To: netdev; +Cc: sasha.levin, hannes, Cong Wang
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 <sasha.levin@oracle.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Tested-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
net/ipv6/addrconf.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 17f8e7e..1f21087 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -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);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch net] addrconf: always initialize sysctl table data
2015-12-21 18:55 [Patch net] addrconf: always initialize sysctl table data Cong Wang
@ 2015-12-22 22:01 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-12-22 22:01 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev, sasha.levin, hannes
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon, 21 Dec 2015 10:55:45 -0800
> 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 <sasha.levin@oracle.com>
> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Tested-by: Sasha Levin <sasha.levin@oracle.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-12-22 22:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-21 18:55 [Patch net] addrconf: always initialize sysctl table data Cong Wang
2015-12-22 22:01 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.