public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded•com>
To: Jiri Benc <jbenc@redhat•com>, netdev@vger•kernel.org
Cc: Mahesh Bandewar <maheshb@google•com>, Dan Williams <dcbw@redhat•com>
Subject: Re: [PATCH net 1/4 v2] ipvlan: fix addr hash list corruption
Date: Fri, 27 Mar 2015 20:36:36 +0300	[thread overview]
Message-ID: <55159524.8010104@cogentembedded.com> (raw)
In-Reply-To: <b5d7fb60399f0a09914ff6dd94787132f40f5c0f.1427476903.git.jbenc@redhat.com>

Hello.

On 03/27/2015 08:30 PM, Jiri Benc wrote:

> When ipvlan interface with IP addresses attached is brought down and then
> deleted, the assigned addresses are deleted twice from the address hash
> list, first on the interface down and second on the link deletion.
> Similarly, when an address is added while the interface is down, it is added
> second time once the interface is brought up.

> When the interface is down, the addresses should be kept off the hash list
> for performance reasons. Ensure this is true, which also fixes the double add
> problem. To fix the double free, check whether the address is hashed before
> removing it.

> Reported-by: Dan Williams <dcbw@redhat•com>
> Signed-off-by: Jiri Benc <jbenc@redhat•com>
> ---

> Changes since v1: check hlist_unhashed on deletion instead of depending on
> netif_running

[...]

> diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
> index 4f4099d5603d..dbaf67c722a0 100644
> --- a/drivers/net/ipvlan/ipvlan_main.c
> +++ b/drivers/net/ipvlan/ipvlan_main.c
> @@ -622,7 +622,10 @@ static int ipvlan_add_addr6(struct ipvl_dev *ipvlan, struct in6_addr *ip6_addr)
>   	addr->atype = IPVL_IPV6;
>   	list_add_tail_rcu(&addr->anode, &ipvlan->addrs);
>   	ipvlan->ipv6cnt++;
> -	ipvlan_ht_addr_add(ipvlan, addr);
> +	/* If the interface is not up, the address will be added to the hash
> +	 * list by ipvlan_open. */

    The preferred multi-line comment style in the networking code is:

/* Like
  * this.
  */

[...]
> @@ -690,7 +693,10 @@ static int ipvlan_add_addr4(struct ipvl_dev *ipvlan, struct in_addr *ip4_addr)
>   	addr->atype = IPVL_IPV4;
>   	list_add_tail_rcu(&addr->anode, &ipvlan->addrs);
>   	ipvlan->ipv4cnt++;
> -	ipvlan_ht_addr_add(ipvlan, addr);
> +	/* If the interface is not up, the address will be added to the hash
> +	 * list by ipvlan_open. */

    Likewise.

[...]

WBR, Sergei

  reply	other threads:[~2015-03-27 17:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-27 17:30 [PATCH net 0/4] ipvlan: list corruption and rcu fixes Jiri Benc
2015-03-27 17:30 ` [PATCH net 1/4 v2] ipvlan: fix addr hash list corruption Jiri Benc
2015-03-27 17:36   ` Sergei Shtylyov [this message]
2015-03-28  0:16   ` Mahesh Bandewar
2015-03-28 18:17     ` Jiri Benc
2015-03-29 19:23   ` David Miller
2015-03-27 17:30 ` [PATCH net 2/4] ipvlan: protect against concurrent link removal Jiri Benc
2015-03-27 17:30 ` [PATCH net 3/4] ipvlan: do not use rcu operations for address list Jiri Benc
2015-03-27 17:30 ` [PATCH net 4/4] ipvlan: fix check for IP addresses in control path Jiri Benc

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=55159524.8010104@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded$(echo .)com \
    --cc=dcbw@redhat$(echo .)com \
    --cc=jbenc@redhat$(echo .)com \
    --cc=maheshb@google$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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