netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Sabrina Dubroca <sd@queasysnail.net>, netdev@vger.kernel.org
Cc: Jiri Pirko <jiri@resnulli.us>, Felix Jia <felix.jia@alliedtelesis.co.nz>
Subject: Re: [PATCH net v2 1/5] net/ipv6: fix addrconf_sysctl_addr_gen_mode
Date: Mon, 9 Jul 2018 11:20:45 -0600	[thread overview]
Message-ID: <a3f68261-eb58-907b-e13e-32638a361e8c@gmail.com> (raw)
In-Reply-To: <c9860365b10dbd648724a6d65ea0dede8ec56464.1531129207.git.sd@queasysnail.net>

On 7/9/18 4:25 AM, Sabrina Dubroca wrote:
> addrconf_sysctl_addr_gen_mode() has multiple problems. First, it ignores
> the errors returned by proc_dointvec().
> 
> addrconf_sysctl_addr_gen_mode() calls proc_dointvec() directly, which
> writes the value to memory, and then checks if it's valid and may return
> EINVAL. If a bad value is given, the value displayed when reading
> net.ipv6.conf.foo.addr_gen_mode next time will be invalid. In case the
> value provided by the user was valid, addrconf_dev_config() won't be
> called since idev->cnf.addr_gen_mode has already been updated.
> 
> Fix this in the usual way we deal with values that need to be checked
> after the proc_do*() helper has returned: define a local ctl_table and
> storage, call proc_dointvec() on that temporary area, then check and
> store.
> 
> addrconf_sysctl_addr_gen_mode() also writes the new value to the global
> ipv6_devconf_dflt, when we're writing to some netns's default, so that
> new netns will inherit the value that was set by the change occuring in
> any netns. That doesn't make any sense, so let's drop this assignment.
> 
> Finally, since addr_gen_mode is a __u32, switch to proc_douintvec().
> 
> Fixes: d35a00b8e33d ("net/ipv6: allow sysctl to change link-local address generation mode")
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> ---
>  net/ipv6/addrconf.c | 27 ++++++++++++++-------------
>  1 file changed, 14 insertions(+), 13 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@gmail.com>

  reply	other threads:[~2018-07-09 17:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-09 10:25 [PATCH net v2 0/5] net/ipv6: addr_gen_mode fixes Sabrina Dubroca
2018-07-09 10:25 ` [PATCH net v2 1/5] net/ipv6: fix addrconf_sysctl_addr_gen_mode Sabrina Dubroca
2018-07-09 17:20   ` David Ahern [this message]
2018-07-09 10:25 ` [PATCH net v2 2/5] net/ipv6: don't reinitialize ndev->cnf.addr_gen_mode on new inet6_dev Sabrina Dubroca
2018-07-09 10:25 ` [PATCH net v2 3/5] net/ipv6: reserve room for IFLA_INET6_ADDR_GEN_MODE Sabrina Dubroca
2018-07-09 10:25 ` [PATCH net v2 4/5] net/ipv6: propagate net.ipv6.conf.all.addr_gen_mode to devices Sabrina Dubroca
2018-07-09 17:24   ` David Ahern
2018-07-10 10:13     ` Sabrina Dubroca
2018-07-10 12:19       ` David Ahern
2018-07-09 10:25 ` [PATCH net v2 5/5] Documentation: ip-sysctl.txt: document addr_gen_mode Sabrina Dubroca
2018-07-09 17:25   ` David Ahern
2018-07-12  5:51 ` [PATCH net v2 0/5] net/ipv6: addr_gen_mode fixes David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a3f68261-eb58-907b-e13e-32638a361e8c@gmail.com \
    --to=dsahern@gmail.com \
    --cc=felix.jia@alliedtelesis.co.nz \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=sd@queasysnail.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).