All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bonding: fix segfault when primary slave set
@ 2017-07-26 15:50 Tomasz Kulasek
  2017-07-26 17:06 ` Declan Doherty
  0 siblings, 1 reply; 4+ messages in thread
From: Tomasz Kulasek @ 2017-07-26 15:50 UTC (permalink / raw)
  To: dev; +Cc: declan.doherty

rte_eth_bond_primary_set segfaults for invalid port. This patch moves
devices check before use of internal data.

Fixes: 4c42498d916d ("net/bonding: allow slaves to also be bonded devices")

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
---
 drivers/net/bonding/rte_eth_bond_api.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 824ab4f..de1d9e0 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -514,15 +514,14 @@
 {
 	struct bond_dev_private *internals;
 
-	internals =  rte_eth_devices[bonded_port_id].data->dev_private;
-
 	if (valid_bonded_port_id(bonded_port_id) != 0)
 		return -1;
 
+	internals = rte_eth_devices[bonded_port_id].data->dev_private;
+
 	if (valid_slave_port_id(slave_port_id, internals->mode) != 0)
 		return -1;
 
-
 	internals->user_defined_primary_port = 1;
 	internals->primary_port = slave_port_id;
 
-- 
1.9.1

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

* Re: [PATCH] bonding: fix segfault when primary slave set
  2017-07-26 15:50 [PATCH] bonding: fix segfault when primary slave set Tomasz Kulasek
@ 2017-07-26 17:06 ` Declan Doherty
  2017-07-30 21:43   ` Thomas Monjalon
  2017-07-31 12:49   ` Ferruh Yigit
  0 siblings, 2 replies; 4+ messages in thread
From: Declan Doherty @ 2017-07-26 17:06 UTC (permalink / raw)
  To: Tomasz Kulasek, dev

On 26/07/2017 4:50 PM, Tomasz Kulasek wrote:
> rte_eth_bond_primary_set segfaults for invalid port. This patch moves
> devices check before use of internal data.
>
> Fixes: 4c42498d916d ("net/bonding: allow slaves to also be bonded devices")
>
> Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
> ---
>  drivers/net/bonding/rte_eth_bond_api.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
> index 824ab4f..de1d9e0 100644
> --- a/drivers/net/bonding/rte_eth_bond_api.c
> +++ b/drivers/net/bonding/rte_eth_bond_api.c
> @@ -514,15 +514,14 @@
>  {
>  	struct bond_dev_private *internals;
>
> -	internals =  rte_eth_devices[bonded_port_id].data->dev_private;
> -
>  	if (valid_bonded_port_id(bonded_port_id) != 0)
>  		return -1;
>
> +	internals = rte_eth_devices[bonded_port_id].data->dev_private;
> +
>  	if (valid_slave_port_id(slave_port_id, internals->mode) != 0)
>  		return -1;
>
> -
>  	internals->user_defined_primary_port = 1;
>  	internals->primary_port = slave_port_id;
>
>

Acked-by: Declan Doherty <declan.doherty@intel.com>

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

* Re: [PATCH] bonding: fix segfault when primary slave set
  2017-07-26 17:06 ` Declan Doherty
@ 2017-07-30 21:43   ` Thomas Monjalon
  2017-07-31 12:49   ` Ferruh Yigit
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2017-07-30 21:43 UTC (permalink / raw)
  To: Declan Doherty; +Cc: dev, Tomasz Kulasek

26/07/2017 19:06, Declan Doherty:
> On 26/07/2017 4:50 PM, Tomasz Kulasek wrote:
> > rte_eth_bond_primary_set segfaults for invalid port. This patch moves
> > devices check before use of internal data.
> >
> > Fixes: 4c42498d916d ("net/bonding: allow slaves to also be bonded devices")
> >
> > Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
> 
> Acked-by: Declan Doherty <declan.doherty@intel.com>

Please Declan, review patches from other contributors, thanks

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

* Re: [PATCH] bonding: fix segfault when primary slave set
  2017-07-26 17:06 ` Declan Doherty
  2017-07-30 21:43   ` Thomas Monjalon
@ 2017-07-31 12:49   ` Ferruh Yigit
  1 sibling, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2017-07-31 12:49 UTC (permalink / raw)
  To: Declan Doherty, Tomasz Kulasek, dev

On 7/26/2017 6:06 PM, Declan Doherty wrote:
> On 26/07/2017 4:50 PM, Tomasz Kulasek wrote:
>> rte_eth_bond_primary_set segfaults for invalid port. This patch moves
>> devices check before use of internal data.
>>
>> Fixes: 4c42498d916d ("net/bonding: allow slaves to also be bonded devices")
>>
>> Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>

> Acked-by: Declan Doherty <declan.doherty@intel.com>

Applied to dpdk-next-net/master, thanks.

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

end of thread, other threads:[~2017-07-31 12:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-26 15:50 [PATCH] bonding: fix segfault when primary slave set Tomasz Kulasek
2017-07-26 17:06 ` Declan Doherty
2017-07-30 21:43   ` Thomas Monjalon
2017-07-31 12:49   ` Ferruh Yigit

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.