netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH next] nexthop: off by one in nexthop_mpath_select()
@ 2019-06-07 13:56 Dan Carpenter
  2019-06-07 14:54 ` David Ahern
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2019-06-07 13:56 UTC (permalink / raw)
  To: David Ahern; +Cc: David S. Miller, netdev, kernel-janitors

The nhg->nh_entries[] array is allocated in nexthop_grp_alloc() and it
has nhg->num_nh elements so this check should be >= instead of >.

Fixes: f88d8ea67fbd ("ipv6: Plumb support for nexthop object in a fib6_info")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 include/net/nexthop.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/nexthop.h b/include/net/nexthop.h
index aff7b2410057..e019ed9b3dc3 100644
--- a/include/net/nexthop.h
+++ b/include/net/nexthop.h
@@ -160,7 +160,7 @@ struct nexthop *nexthop_mpath_select(const struct nexthop *nh, int nhsel)
 	/* for_nexthops macros in fib_semantics.c grabs a pointer to
 	 * the nexthop before checking nhsel
 	 */
-	if (nhsel > nhg->num_nh)
+	if (nhsel >= nhg->num_nh)
 		return NULL;
 
 	return nhg->nh_entries[nhsel].nh;
-- 
2.20.1


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

* Re: [PATCH next] nexthop: off by one in nexthop_mpath_select()
  2019-06-07 13:56 [PATCH next] nexthop: off by one in nexthop_mpath_select() Dan Carpenter
@ 2019-06-07 14:54 ` David Ahern
  2019-06-07 15:29   ` Dan Carpenter
  2019-06-07 15:31   ` [PATCH v2 " Dan Carpenter
  0 siblings, 2 replies; 5+ messages in thread
From: David Ahern @ 2019-06-07 14:54 UTC (permalink / raw)
  To: Dan Carpenter, David Ahern; +Cc: David S. Miller, netdev, kernel-janitors

On 6/7/19 7:56 AM, Dan Carpenter wrote:
> The nhg->nh_entries[] array is allocated in nexthop_grp_alloc() and it
> has nhg->num_nh elements so this check should be >= instead of >.
> 
> Fixes: f88d8ea67fbd ("ipv6: Plumb support for nexthop object in a fib6_info")

Wrong fixes. The helper was added by 430a049190de so it should be

Fixes: 430a049190de ("nexthop: Add support for nexthop groups")

> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  include/net/nexthop.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/net/nexthop.h b/include/net/nexthop.h
> index aff7b2410057..e019ed9b3dc3 100644
> --- a/include/net/nexthop.h
> +++ b/include/net/nexthop.h
> @@ -160,7 +160,7 @@ struct nexthop *nexthop_mpath_select(const struct nexthop *nh, int nhsel)
>  	/* for_nexthops macros in fib_semantics.c grabs a pointer to
>  	 * the nexthop before checking nhsel
>  	 */
> -	if (nhsel > nhg->num_nh)
> +	if (nhsel >= nhg->num_nh)
>  		return NULL;
>  
>  	return nhg->nh_entries[nhsel].nh;
> 

Thanks for the patch.

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

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

* Re: [PATCH next] nexthop: off by one in nexthop_mpath_select()
  2019-06-07 14:54 ` David Ahern
@ 2019-06-07 15:29   ` Dan Carpenter
  2019-06-07 15:31   ` [PATCH v2 " Dan Carpenter
  1 sibling, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2019-06-07 15:29 UTC (permalink / raw)
  To: David Ahern; +Cc: David Ahern, David S. Miller, netdev, kernel-janitors

On Fri, Jun 07, 2019 at 08:54:33AM -0600, David Ahern wrote:
> On 6/7/19 7:56 AM, Dan Carpenter wrote:
> > The nhg->nh_entries[] array is allocated in nexthop_grp_alloc() and it
> > has nhg->num_nh elements so this check should be >= instead of >.
> > 
> > Fixes: f88d8ea67fbd ("ipv6: Plumb support for nexthop object in a fib6_info")
> 
> Wrong fixes. The helper was added by 430a049190de so it should be
> 
> Fixes: 430a049190de ("nexthop: Add support for nexthop groups")
> 

Sorry, my eyes must have gone squiffy.  I don't even know how I got that
wrong.  Let me resend.

regards,
dan carpenter


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

* [PATCH v2 next] nexthop: off by one in nexthop_mpath_select()
  2019-06-07 14:54 ` David Ahern
  2019-06-07 15:29   ` Dan Carpenter
@ 2019-06-07 15:31   ` Dan Carpenter
  2019-06-09 20:38     ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2019-06-07 15:31 UTC (permalink / raw)
  To: David Ahern; +Cc: David S. Miller, netdev, kernel-janitors

The nhg->nh_entries[] array is allocated in nexthop_grp_alloc() and it
has nhg->num_nh elements so this check should be >= instead of >.

Fixes: 430a049190de ("nexthop: Add support for nexthop groups")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
---
v2: Use the correct Fixes tag

 include/net/nexthop.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/nexthop.h b/include/net/nexthop.h
index aff7b2410057..e019ed9b3dc3 100644
--- a/include/net/nexthop.h
+++ b/include/net/nexthop.h
@@ -160,7 +160,7 @@ struct nexthop *nexthop_mpath_select(const struct nexthop *nh, int nhsel)
 	/* for_nexthops macros in fib_semantics.c grabs a pointer to
 	 * the nexthop before checking nhsel
 	 */
-	if (nhsel > nhg->num_nh)
+	if (nhsel >= nhg->num_nh)
 		return NULL;
 
 	return nhg->nh_entries[nhsel].nh;
-- 
2.20.1

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

* Re: [PATCH v2 next] nexthop: off by one in nexthop_mpath_select()
  2019-06-07 15:31   ` [PATCH v2 " Dan Carpenter
@ 2019-06-09 20:38     ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-06-09 20:38 UTC (permalink / raw)
  To: dan.carpenter; +Cc: dsahern, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Fri, 7 Jun 2019 18:31:07 +0300

> The nhg->nh_entries[] array is allocated in nexthop_grp_alloc() and it
> has nhg->num_nh elements so this check should be >= instead of >.
> 
> Fixes: 430a049190de ("nexthop: Add support for nexthop groups")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reviewed-by: David Ahern <dsahern@gmail.com>
> ---
> v2: Use the correct Fixes tag

Applied, thanks Dan.

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

end of thread, other threads:[~2019-06-09 20:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-07 13:56 [PATCH next] nexthop: off by one in nexthop_mpath_select() Dan Carpenter
2019-06-07 14:54 ` David Ahern
2019-06-07 15:29   ` Dan Carpenter
2019-06-07 15:31   ` [PATCH v2 " Dan Carpenter
2019-06-09 20:38     ` David Miller

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