All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arp: Remove the arp_hh_ops structure
@ 2021-02-22  3:15 Yejune Deng
  2021-02-22  8:37 ` Eric Dumazet
  0 siblings, 1 reply; 7+ messages in thread
From: Yejune Deng @ 2021-02-22  3:15 UTC (permalink / raw)
  To: davem, yoshfuji, dsahern, kuba
  Cc: netdev, linux-kernel, yejune.deng, kernel test robot

The arp_hh_ops structure is similar to the arp_generic_ops structure.
but the latter is more general,so remove the arp_hh_ops structure.

Fix when took out the neigh->ops assignment:
8.973653] #PF: supervisor read access in kernel mode
[    8.975027] #PF: error_code(0x0000) - not-present page
[    8.976310] PGD 0 P4D 0
[    8.977036] Oops: 0000 [#1] SMP PTI
[    8.977973] CPU: 1 PID: 210 Comm: sd-resolve Not tainted 5.11.0-rc7-02046-g4591591ab715 #1
[    8.979998] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
[    8.981996] RIP: 0010:neigh_probe (kbuild/src/consumer/net/core/neighbour.c:1009)

Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Yejune Deng <yejune.deng@gmail.com>
---
 net/ipv4/arp.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 922dd73e5740..9ee59c2e419a 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -135,14 +135,6 @@ static const struct neigh_ops arp_generic_ops = {
 	.connected_output =	neigh_connected_output,
 };
 
-static const struct neigh_ops arp_hh_ops = {
-	.family =		AF_INET,
-	.solicit =		arp_solicit,
-	.error_report =		arp_error_report,
-	.output =		neigh_resolve_output,
-	.connected_output =	neigh_resolve_output,
-};
-
 static const struct neigh_ops arp_direct_ops = {
 	.family =		AF_INET,
 	.output =		neigh_direct_output,
@@ -277,12 +269,9 @@ static int arp_constructor(struct neighbour *neigh)
 			memcpy(neigh->ha, dev->broadcast, dev->addr_len);
 		}
 
-		if (dev->header_ops->cache)
-			neigh->ops = &arp_hh_ops;
-		else
-			neigh->ops = &arp_generic_ops;
+		neigh->ops = &arp_generic_ops;
 
-		if (neigh->nud_state & NUD_VALID)
+		if (!dev->header_ops->cache && (neigh->nud_state & NUD_VALID))
 			neigh->output = neigh->ops->connected_output;
 		else
 			neigh->output = neigh->ops->output;
-- 
2.29.0


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

* Re: [PATCH] arp: Remove the arp_hh_ops structure
  2021-02-22  3:15 [PATCH] arp: Remove the arp_hh_ops structure Yejune Deng
@ 2021-02-22  8:37 ` Eric Dumazet
  2021-02-22 16:07   ` David Ahern
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Dumazet @ 2021-02-22  8:37 UTC (permalink / raw)
  To: Yejune Deng, davem, yoshfuji, dsahern, kuba
  Cc: netdev, linux-kernel, kernel test robot



On 2/22/21 4:15 AM, Yejune Deng wrote:
> The arp_hh_ops structure is similar to the arp_generic_ops structure.
> but the latter is more general,so remove the arp_hh_ops structure.
> 
> Fix when took out the neigh->ops assignment:
> 8.973653] #PF: supervisor read access in kernel mode
> [    8.975027] #PF: error_code(0x0000) - not-present page
> [    8.976310] PGD 0 P4D 0
> [    8.977036] Oops: 0000 [#1] SMP PTI
> [    8.977973] CPU: 1 PID: 210 Comm: sd-resolve Not tainted 5.11.0-rc7-02046-g4591591ab715 #1
> [    8.979998] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
> [    8.981996] RIP: 0010:neigh_probe (kbuild/src/consumer/net/core/neighbour.c:1009)
> 

I have a hard time understanding this patch submission.

This seems a mix of a net-next and net material ?



> Reported-by: kernel test robot <oliver.sang@intel.com>

If this is a bug fix, we want a Fixes: tag

This will really help us. Please don't let us guess what is going on.


Also, if this is not a bug fix, this should target net-next tree,
please take a look at Documentation/networking/netdev-FAQ.rst

In short, the stack trace in this changelog seems to be not
related to this patch, maybe a prior version ? We do not want
to keep artifacts of some buggy version that was never merged
into official tree.

Thanks.

> Signed-off-by: Yejune Deng <yejune.deng@gmail.com>
> ---
>  net/ipv4/arp.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
> index 922dd73e5740..9ee59c2e419a 100644
> --- a/net/ipv4/arp.c
> +++ b/net/ipv4/arp.c
> @@ -135,14 +135,6 @@ static const struct neigh_ops arp_generic_ops = {
>  	.connected_output =	neigh_connected_output,
>  };
>  
> -static const struct neigh_ops arp_hh_ops = {
> -	.family =		AF_INET,
> -	.solicit =		arp_solicit,
> -	.error_report =		arp_error_report,
> -	.output =		neigh_resolve_output,
> -	.connected_output =	neigh_resolve_output,
> -};
> -
>  static const struct neigh_ops arp_direct_ops = {
>  	.family =		AF_INET,
>  	.output =		neigh_direct_output,
> @@ -277,12 +269,9 @@ static int arp_constructor(struct neighbour *neigh)
>  			memcpy(neigh->ha, dev->broadcast, dev->addr_len);
>  		}
>  
> -		if (dev->header_ops->cache)
> -			neigh->ops = &arp_hh_ops;
> -		else
> -			neigh->ops = &arp_generic_ops;
> +		neigh->ops = &arp_generic_ops;
>  
> -		if (neigh->nud_state & NUD_VALID)
> +		if (!dev->header_ops->cache && (neigh->nud_state & NUD_VALID))
>  			neigh->output = neigh->ops->connected_output;
>  		else
>  			neigh->output = neigh->ops->output;
> 

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

* Re: [PATCH] arp: Remove the arp_hh_ops structure
  2021-02-22  8:37 ` Eric Dumazet
@ 2021-02-22 16:07   ` David Ahern
  2021-02-23  7:00     ` Yejune Deng
  0 siblings, 1 reply; 7+ messages in thread
From: David Ahern @ 2021-02-22 16:07 UTC (permalink / raw)
  To: Eric Dumazet, Yejune Deng, davem, yoshfuji, dsahern, kuba
  Cc: netdev, linux-kernel, kernel test robot

On 2/22/21 1:37 AM, Eric Dumazet wrote:
> 
> 
> On 2/22/21 4:15 AM, Yejune Deng wrote:
>> The arp_hh_ops structure is similar to the arp_generic_ops structure.
>> but the latter is more general,so remove the arp_hh_ops structure.
>>
>> Fix when took out the neigh->ops assignment:
>> 8.973653] #PF: supervisor read access in kernel mode
>> [    8.975027] #PF: error_code(0x0000) - not-present page
>> [    8.976310] PGD 0 P4D 0
>> [    8.977036] Oops: 0000 [#1] SMP PTI
>> [    8.977973] CPU: 1 PID: 210 Comm: sd-resolve Not tainted 5.11.0-rc7-02046-g4591591ab715 #1
>> [    8.979998] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
>> [    8.981996] RIP: 0010:neigh_probe (kbuild/src/consumer/net/core/neighbour.c:1009)
>>
> 
> I have a hard time understanding this patch submission.
> 
> This seems a mix of a net-next and net material ?

It is net-next at best.

> 
> 
> 
>> Reported-by: kernel test robot <oliver.sang@intel.com>
> 
> If this is a bug fix, we want a Fixes: tag
> 
> This will really help us. Please don't let us guess what is going on.
> 

This patch is a v2. v1 was clearly wrong and not tested; I responded as
such 12 hours before the robot test.

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

* Re: [PATCH] arp: Remove the arp_hh_ops structure
  2021-02-22 16:07   ` David Ahern
@ 2021-02-23  7:00     ` Yejune Deng
  0 siblings, 0 replies; 7+ messages in thread
From: Yejune Deng @ 2021-02-23  7:00 UTC (permalink / raw)
  To: David Ahern
  Cc: Eric Dumazet, David Miller, yoshfuji, dsahern, Jakub Kicinski,
	netdev, Linux Kernel Mailing List, kernel test robot

Thank you for the clarification.

On Tue, Feb 23, 2021 at 12:07 AM David Ahern <dsahern@gmail.com> wrote:
>
> On 2/22/21 1:37 AM, Eric Dumazet wrote:
> >
> >
> > On 2/22/21 4:15 AM, Yejune Deng wrote:
> >> The arp_hh_ops structure is similar to the arp_generic_ops structure.
> >> but the latter is more general,so remove the arp_hh_ops structure.
> >>
> >> Fix when took out the neigh->ops assignment:
> >> 8.973653] #PF: supervisor read access in kernel mode
> >> [    8.975027] #PF: error_code(0x0000) - not-present page
> >> [    8.976310] PGD 0 P4D 0
> >> [    8.977036] Oops: 0000 [#1] SMP PTI
> >> [    8.977973] CPU: 1 PID: 210 Comm: sd-resolve Not tainted 5.11.0-rc7-02046-g4591591ab715 #1
> >> [    8.979998] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
> >> [    8.981996] RIP: 0010:neigh_probe (kbuild/src/consumer/net/core/neighbour.c:1009)
> >>
> >
> > I have a hard time understanding this patch submission.
> >
> > This seems a mix of a net-next and net material ?
>
> It is net-next at best.
>
> >
> >
> >
> >> Reported-by: kernel test robot <oliver.sang@intel.com>
> >
> > If this is a bug fix, we want a Fixes: tag
> >
> > This will really help us. Please don't let us guess what is going on.
> >
>
> This patch is a v2. v1 was clearly wrong and not tested; I responded as
> such 12 hours before the robot test.

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

* Re: [PATCH] arp: Remove the arp_hh_ops structure
  2021-02-21  1:54 ` David Ahern
@ 2021-02-21  2:20   ` Yejune Deng
  0 siblings, 0 replies; 7+ messages in thread
From: Yejune Deng @ 2021-02-21  2:20 UTC (permalink / raw)
  To: David Ahern
  Cc: David Miller, yoshfuji, dsahern, Jakub Kicinski, netdev,
	Linux Kernel Mailing List

Sorry,it was my fault, I will resubmit.

On Sun, Feb 21, 2021 at 9:54 AM David Ahern <dsahern@gmail.com> wrote:
>
> On 2/19/21 9:32 PM, Yejune Deng wrote:
> >  static const struct neigh_ops arp_direct_ops = {
> >       .family =               AF_INET,
> >       .output =               neigh_direct_output,
> > @@ -277,15 +269,10 @@ static int arp_constructor(struct neighbour *neigh)
> >                       memcpy(neigh->ha, dev->broadcast, dev->addr_len);
> >               }
> >
> > -             if (dev->header_ops->cache)
> > -                     neigh->ops = &arp_hh_ops;
> > -             else
> > -                     neigh->ops = &arp_generic_ops;
>
> How did you test this?
>
> you took out the neigh->ops assignment, so all of the neigh->ops in
> net/core/neighbour.c are going to cause a NULL dereference.
>
>
> > -
> > -             if (neigh->nud_state & NUD_VALID)
> > -                     neigh->output = neigh->ops->connected_output;
> > +             if (!dev->header_ops->cache && (neigh->nud_state & NUD_VALID))
> > +                     neigh->output = arp_generic_ops.connected_output;
> >               else
> > -                     neigh->output = neigh->ops->output;
> > +                     neigh->output = arp_generic_ops.output;
> >       }
> >       return 0;
> >  }
> >
>

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

* Re: [PATCH] arp: Remove the arp_hh_ops structure
  2021-02-20  4:32 Yejune Deng
@ 2021-02-21  1:54 ` David Ahern
  2021-02-21  2:20   ` Yejune Deng
  0 siblings, 1 reply; 7+ messages in thread
From: David Ahern @ 2021-02-21  1:54 UTC (permalink / raw)
  To: Yejune Deng, davem, yoshfuji, dsahern, kuba; +Cc: netdev, linux-kernel

On 2/19/21 9:32 PM, Yejune Deng wrote:
>  static const struct neigh_ops arp_direct_ops = {
>  	.family =		AF_INET,
>  	.output =		neigh_direct_output,
> @@ -277,15 +269,10 @@ static int arp_constructor(struct neighbour *neigh)
>  			memcpy(neigh->ha, dev->broadcast, dev->addr_len);
>  		}
>  
> -		if (dev->header_ops->cache)
> -			neigh->ops = &arp_hh_ops;
> -		else
> -			neigh->ops = &arp_generic_ops;

How did you test this?

you took out the neigh->ops assignment, so all of the neigh->ops in
net/core/neighbour.c are going to cause a NULL dereference.


> -
> -		if (neigh->nud_state & NUD_VALID)
> -			neigh->output = neigh->ops->connected_output;
> +		if (!dev->header_ops->cache && (neigh->nud_state & NUD_VALID))
> +			neigh->output = arp_generic_ops.connected_output;
>  		else
> -			neigh->output = neigh->ops->output;
> +			neigh->output = arp_generic_ops.output;
>  	}
>  	return 0;
>  }
> 


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

* [PATCH] arp: Remove the arp_hh_ops structure
@ 2021-02-20  4:32 Yejune Deng
  2021-02-21  1:54 ` David Ahern
  0 siblings, 1 reply; 7+ messages in thread
From: Yejune Deng @ 2021-02-20  4:32 UTC (permalink / raw)
  To: davem, yoshfuji, dsahern, kuba; +Cc: netdev, linux-kernel, yejune.deng

The 'arp_hh_ops' structure is similar to the 'arp_generic_ops' structure.
So remove the 'arp_hh_ops' structure.

Signed-off-by: Yejune Deng <yejune.deng@gmail.com>
---
 net/ipv4/arp.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 922dd73e5740..6d60d9b89286 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -135,14 +135,6 @@ static const struct neigh_ops arp_generic_ops = {
 	.connected_output =	neigh_connected_output,
 };
 
-static const struct neigh_ops arp_hh_ops = {
-	.family =		AF_INET,
-	.solicit =		arp_solicit,
-	.error_report =		arp_error_report,
-	.output =		neigh_resolve_output,
-	.connected_output =	neigh_resolve_output,
-};
-
 static const struct neigh_ops arp_direct_ops = {
 	.family =		AF_INET,
 	.output =		neigh_direct_output,
@@ -277,15 +269,10 @@ static int arp_constructor(struct neighbour *neigh)
 			memcpy(neigh->ha, dev->broadcast, dev->addr_len);
 		}
 
-		if (dev->header_ops->cache)
-			neigh->ops = &arp_hh_ops;
-		else
-			neigh->ops = &arp_generic_ops;
-
-		if (neigh->nud_state & NUD_VALID)
-			neigh->output = neigh->ops->connected_output;
+		if (!dev->header_ops->cache && (neigh->nud_state & NUD_VALID))
+			neigh->output = arp_generic_ops.connected_output;
 		else
-			neigh->output = neigh->ops->output;
+			neigh->output = arp_generic_ops.output;
 	}
 	return 0;
 }
-- 
2.29.0


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

end of thread, other threads:[~2021-02-23  7:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-22  3:15 [PATCH] arp: Remove the arp_hh_ops structure Yejune Deng
2021-02-22  8:37 ` Eric Dumazet
2021-02-22 16:07   ` David Ahern
2021-02-23  7:00     ` Yejune Deng
  -- strict thread matches above, loose matches on Subject: below --
2021-02-20  4:32 Yejune Deng
2021-02-21  1:54 ` David Ahern
2021-02-21  2:20   ` Yejune Deng

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.