netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][V2] nfp: check idx is -ENOSPC before using it is an index
@ 2016-07-11 15:54 Colin King
       [not found] ` <1468252460-15117-1-git-send-email-colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
  2016-07-11 20:52 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2016-07-11 15:54 UTC (permalink / raw)
  To: Jakub Kicinski, Lauro Ramos Venancio, Aloisio Almeida Jr,
	Samuel Ortiz, David S . Miller, Rolf Neugebauer,
	Christophe Ricard, Robert Dolca, oss-drivers, netdev,
	linux-wireless

From: Colin Ian King <colin.king@canonical.com>

idx can be returned as -ENOSPC, so we should check for this first
before using it as an index into nn->vxlan_usecnt[] to avoid an
out of bounds array offset read.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index 1e74b91..88678c1 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -2578,7 +2578,7 @@ static void nfp_net_del_vxlan_port(struct net_device *netdev,
 		return;
 
 	idx = nfp_net_find_vxlan_idx(nn, ti->port);
-	if (!nn->vxlan_usecnt[idx] || idx == -ENOSPC)
+	if (idx == -ENOSPC || !nn->vxlan_usecnt[idx])
 		return;
 
 	if (!--nn->vxlan_usecnt[idx])
-- 
2.8.1

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

* Re: [oss-drivers] [PATCH][V2] nfp: check idx is -ENOSPC before using it is an index
       [not found] ` <1468252460-15117-1-git-send-email-colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
@ 2016-07-11 15:59   ` Jakub Kicinski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2016-07-11 15:59 UTC (permalink / raw)
  To: Colin King
  Cc: Lauro Ramos Venancio, Aloisio Almeida Jr, Samuel Ortiz,
	David S . Miller, Rolf Neugebauer, Christophe Ricard,
	Robert Dolca, oss-drivers-wFxRvT7yatFl57MIdRCFDg,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA

On Mon, 11 Jul 2016 16:54:20 +0100, Colin King wrote:
> From: Colin Ian King <colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
> 
> idx can be returned as -ENOSPC, so we should check for this first
> before using it as an index into nn->vxlan_usecnt[] to avoid an
> out of bounds array offset read.
> 
> Signed-off-by: Colin Ian King <colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>

Acked-by: Jakub Kicinski <jakub.kicinski-wFxRvT7yatFl57MIdRCFDg@public.gmane.org>

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH][V2] nfp: check idx is -ENOSPC before using it is an index
  2016-07-11 15:54 [PATCH][V2] nfp: check idx is -ENOSPC before using it is an index Colin King
       [not found] ` <1468252460-15117-1-git-send-email-colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
@ 2016-07-11 20:52 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-07-11 20:52 UTC (permalink / raw)
  To: colin.king
  Cc: jakub.kicinski, lauro.venancio, aloisio.almeida, sameo,
	rolf.neugebauer, christophe.ricard, robert.dolca, oss-drivers,
	netdev, linux-wireless

From: Colin King <colin.king@canonical.com>
Date: Mon, 11 Jul 2016 16:54:20 +0100

> From: Colin Ian King <colin.king@canonical.com>
> 
> idx can be returned as -ENOSPC, so we should check for this first
> before using it as an index into nn->vxlan_usecnt[] to avoid an
> out of bounds array offset read.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied to net-next.

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

end of thread, other threads:[~2016-07-11 20:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-11 15:54 [PATCH][V2] nfp: check idx is -ENOSPC before using it is an index Colin King
     [not found] ` <1468252460-15117-1-git-send-email-colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2016-07-11 15:59   ` [oss-drivers] " Jakub Kicinski
2016-07-11 20:52 ` 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).