netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch] arp: fix a regression in arp_solicit()
@ 2012-12-23 14:42 Cong Wang
  2012-12-23 14:49 ` Sedat Dilek
  0 siblings, 1 reply; 7+ messages in thread
From: Cong Wang @ 2012-12-23 14:42 UTC (permalink / raw)
  To: netdev
  Cc: Sedat Dilek, Eric Dumazet, David S. Miller, Julian Anastasov,
	Cong Wang

From: Cong Wang <xiyou.wangcong@gmail.com>

Sedat reported the following commit caused a regression:

commit 9650388b5c56578fdccc79c57a8c82fb92b8e7f1
Author: Eric Dumazet <edumazet@google.com>
Date:   Fri Dec 21 07:32:10 2012 +0000

    ipv4: arp: fix a lockdep splat in arp_solicit

This is due to the 6th parameter of arp_send() needs to be NULL
for broatcase case, the above commit changed it to all-zero non-NULL
hw addr.

Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

---
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 1169ed4..9547a273 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -321,7 +321,7 @@ static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb)
 static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
 {
 	__be32 saddr = 0;
-	u8 dst_ha[MAX_ADDR_LEN];
+	u8 dst_ha[MAX_ADDR_LEN], *dst_hw = NULL;
 	struct net_device *dev = neigh->dev;
 	__be32 target = *(__be32 *)neigh->primary_key;
 	int probes = atomic_read(&neigh->probes);
@@ -364,8 +364,8 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
 		if (!(neigh->nud_state & NUD_VALID))
 			pr_debug("trying to ucast probe in NUD_INVALID\n");
 		neigh_ha_snapshot(dst_ha, neigh, dev);
+		dst_hw = dst_ha;
 	} else {
-		memset(dst_ha, 0, dev->addr_len);
 		probes -= neigh->parms->app_probes;
 		if (probes < 0) {
 #ifdef CONFIG_ARPD
@@ -376,7 +376,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
 	}
 
 	arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr,
-		 dst_ha, dev->dev_addr, NULL);
+		 dst_hw, dev->dev_addr, NULL);
 }
 
 static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Patch] arp: fix a regression in arp_solicit()
  2012-12-23 14:42 [Patch] arp: fix a regression in arp_solicit() Cong Wang
@ 2012-12-23 14:49 ` Sedat Dilek
  2012-12-23 14:58   ` Sedat Dilek
  0 siblings, 1 reply; 7+ messages in thread
From: Sedat Dilek @ 2012-12-23 14:49 UTC (permalink / raw)
  To: Cong Wang; +Cc: netdev, Eric Dumazet, David S. Miller, Julian Anastasov

On Sun, Dec 23, 2012 at 3:42 PM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> From: Cong Wang <xiyou.wangcong@gmail.com>
>
> Sedat reported the following commit caused a regression:
>
> commit 9650388b5c56578fdccc79c57a8c82fb92b8e7f1
> Author: Eric Dumazet <edumazet@google.com>
> Date:   Fri Dec 21 07:32:10 2012 +0000
>
>     ipv4: arp: fix a lockdep splat in arp_solicit
>
> This is due to the 6th parameter of arp_send() needs to be NULL
> for broatcase case, the above commit changed it to all-zero non-NULL
> hw addr.
>

s/broatcase/broadcast ?

- Sedat -

> Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
> Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
> Cc: Sedat Dilek <sedat.dilek@gmail.com>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Julian Anastasov <ja@ssi.bg>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
>
> ---
> diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
> index 1169ed4..9547a273 100644
> --- a/net/ipv4/arp.c
> +++ b/net/ipv4/arp.c
> @@ -321,7 +321,7 @@ static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb)
>  static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
>  {
>         __be32 saddr = 0;
> -       u8 dst_ha[MAX_ADDR_LEN];
> +       u8 dst_ha[MAX_ADDR_LEN], *dst_hw = NULL;
>         struct net_device *dev = neigh->dev;
>         __be32 target = *(__be32 *)neigh->primary_key;
>         int probes = atomic_read(&neigh->probes);
> @@ -364,8 +364,8 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
>                 if (!(neigh->nud_state & NUD_VALID))
>                         pr_debug("trying to ucast probe in NUD_INVALID\n");
>                 neigh_ha_snapshot(dst_ha, neigh, dev);
> +               dst_hw = dst_ha;
>         } else {
> -               memset(dst_ha, 0, dev->addr_len);
>                 probes -= neigh->parms->app_probes;
>                 if (probes < 0) {
>  #ifdef CONFIG_ARPD
> @@ -376,7 +376,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
>         }
>
>         arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr,
> -                dst_ha, dev->dev_addr, NULL);
> +                dst_hw, dev->dev_addr, NULL);
>  }
>
>  static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Patch] arp: fix a regression in arp_solicit()
  2012-12-23 14:49 ` Sedat Dilek
@ 2012-12-23 14:58   ` Sedat Dilek
  2012-12-23 22:17     ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Sedat Dilek @ 2012-12-23 14:58 UTC (permalink / raw)
  To: Cong Wang; +Cc: netdev, Eric Dumazet, David S. Miller, Julian Anastasov

On Sun, Dec 23, 2012 at 3:49 PM, Sedat Dilek <sedat.dilek@gmail.com> wrote:
> On Sun, Dec 23, 2012 at 3:42 PM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
>> From: Cong Wang <xiyou.wangcong@gmail.com>
>>
>> Sedat reported the following commit caused a regression:
>>
>> commit 9650388b5c56578fdccc79c57a8c82fb92b8e7f1
>> Author: Eric Dumazet <edumazet@google.com>
>> Date:   Fri Dec 21 07:32:10 2012 +0000
>>
>>     ipv4: arp: fix a lockdep splat in arp_solicit
>>
>> This is due to the 6th parameter of arp_send() needs to be NULL
>> for broatcase case, the above commit changed it to all-zero non-NULL
>> hw addr.
>>
>
> s/broatcase/broadcast ?
>

While at it you might enhance the label with "ipv4"?

ipv4: arp: fix a regression in arp_solicit()

> - Sedat -
>
>> Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
>> Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
>> Cc: Sedat Dilek <sedat.dilek@gmail.com>
>> Cc: Eric Dumazet <edumazet@google.com>
>> Cc: David S. Miller <davem@davemloft.net>
>> Cc: Julian Anastasov <ja@ssi.bg>
>> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
>>
>> ---
>> diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
>> index 1169ed4..9547a273 100644
>> --- a/net/ipv4/arp.c
>> +++ b/net/ipv4/arp.c
>> @@ -321,7 +321,7 @@ static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb)
>>  static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
>>  {
>>         __be32 saddr = 0;
>> -       u8 dst_ha[MAX_ADDR_LEN];
>> +       u8 dst_ha[MAX_ADDR_LEN], *dst_hw = NULL;
>>         struct net_device *dev = neigh->dev;
>>         __be32 target = *(__be32 *)neigh->primary_key;
>>         int probes = atomic_read(&neigh->probes);
>> @@ -364,8 +364,8 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
>>                 if (!(neigh->nud_state & NUD_VALID))
>>                         pr_debug("trying to ucast probe in NUD_INVALID\n");
>>                 neigh_ha_snapshot(dst_ha, neigh, dev);
>> +               dst_hw = dst_ha;
>>         } else {
>> -               memset(dst_ha, 0, dev->addr_len);
>>                 probes -= neigh->parms->app_probes;
>>                 if (probes < 0) {
>>  #ifdef CONFIG_ARPD
>> @@ -376,7 +376,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
>>         }
>>
>>         arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr,
>> -                dst_ha, dev->dev_addr, NULL);
>> +                dst_hw, dev->dev_addr, NULL);
>>  }
>>
>>  static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Patch] arp: fix a regression in arp_solicit()
  2012-12-23 14:58   ` Sedat Dilek
@ 2012-12-23 22:17     ` David Miller
  2012-12-24  1:21       ` Cong Wang
  2012-12-24  1:33       ` Sedat Dilek
  0 siblings, 2 replies; 7+ messages in thread
From: David Miller @ 2012-12-23 22:17 UTC (permalink / raw)
  To: sedat.dilek; +Cc: xiyou.wangcong, netdev, edumazet, ja

From: Sedat Dilek <sedat.dilek@gmail.com>
Date: Sun, 23 Dec 2012 15:58:52 +0100

> While at it you might enhance the label with "ipv4"?

That's excessive.

ARP is ipv4 and ipv4 only, in other protocols it has completely
different names.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Patch] arp: fix a regression in arp_solicit()
  2012-12-23 22:17     ` David Miller
@ 2012-12-24  1:21       ` Cong Wang
  2012-12-24  1:33       ` Sedat Dilek
  1 sibling, 0 replies; 7+ messages in thread
From: Cong Wang @ 2012-12-24  1:21 UTC (permalink / raw)
  To: David Miller
  Cc: sedat.dilek, Linux Kernel Network Developers, edumazet,
	Julian Anastasov

On Mon, Dec 24, 2012 at 6:17 AM, David Miller <davem@davemloft.net> wrote:
> From: Sedat Dilek <sedat.dilek@gmail.com>
> Date: Sun, 23 Dec 2012 15:58:52 +0100
>
>> While at it you might enhance the label with "ipv4"?
>
> That's excessive.
>
> ARP is ipv4 and ipv4 only, in other protocols it has completely
> different names.

Agreed. I will resend the patch with the typo fixed.

Thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Patch] arp: fix a regression in arp_solicit()
  2012-12-23 22:17     ` David Miller
  2012-12-24  1:21       ` Cong Wang
@ 2012-12-24  1:33       ` Sedat Dilek
  2012-12-24  1:44         ` Sedat Dilek
  1 sibling, 1 reply; 7+ messages in thread
From: Sedat Dilek @ 2012-12-24  1:33 UTC (permalink / raw)
  To: David Miller; +Cc: xiyou.wangcong, netdev, edumazet, ja

On Sun, Dec 23, 2012 at 11:17 PM, David Miller <davem@davemloft.net> wrote:
> From: Sedat Dilek <sedat.dilek@gmail.com>
> Date: Sun, 23 Dec 2012 15:58:52 +0100
>
>> While at it you might enhance the label with "ipv4"?
>
> That's excessive.
>
> ARP is ipv4 and ipv4 only, in other protocols it has completely
> different names.

OK, I see (shorter subject is always good).
I oriented myself at the original commit from Eric which was labeled the same.
Just had a look at the git-history [1] myself...

- Sedat -

[1] http://git.kernel.org/?p=linux/kernel/git/davem/net.git;a=history;f=net/ipv4/arp.c

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Patch] arp: fix a regression in arp_solicit()
  2012-12-24  1:33       ` Sedat Dilek
@ 2012-12-24  1:44         ` Sedat Dilek
  0 siblings, 0 replies; 7+ messages in thread
From: Sedat Dilek @ 2012-12-24  1:44 UTC (permalink / raw)
  To: David Miller; +Cc: xiyou.wangcong, netdev, edumazet, ja

On Mon, Dec 24, 2012 at 2:33 AM, Sedat Dilek <sedat.dilek@gmail.com> wrote:
> On Sun, Dec 23, 2012 at 11:17 PM, David Miller <davem@davemloft.net> wrote:
>> From: Sedat Dilek <sedat.dilek@gmail.com>
>> Date: Sun, 23 Dec 2012 15:58:52 +0100
>>
>>> While at it you might enhance the label with "ipv4"?
>>
>> That's excessive.
>>
>> ARP is ipv4 and ipv4 only, in other protocols it has completely
>> different names.
>
> OK, I see (shorter subject is always good).
> I oriented myself at the original commit from Eric which was labeled the same.
> Just had a look at the git-history [1] myself...
>

Hmm, 'man arp' does not mention as IPv4-only.
So, Neighbor Discovery Protocol (NDP) is the "IPv6 equivalent".
Just as a note to myself.

- Sedat -

[1] http://en.wikipedia.org/wiki/Address_Resolution_Protocol
[2] https://kb.wisc.edu/ns/page.php?id=12364

> - Sedat -
>
> [1] http://git.kernel.org/?p=linux/kernel/git/davem/net.git;a=history;f=net/ipv4/arp.c

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-12-24  1:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-23 14:42 [Patch] arp: fix a regression in arp_solicit() Cong Wang
2012-12-23 14:49 ` Sedat Dilek
2012-12-23 14:58   ` Sedat Dilek
2012-12-23 22:17     ` David Miller
2012-12-24  1:21       ` Cong Wang
2012-12-24  1:33       ` Sedat Dilek
2012-12-24  1:44         ` Sedat Dilek

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).