[dpdk-dev] [PATCH] librte_ether: fix crashes in rte_ethdev functions.

Iremonger, Bernard bernard.iremonger at intel.com
Mon Dec 21 16:01:18 CET 2015


Hi Konstantin,

> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Monday, December 21, 2015 12:02 PM
> To: Iremonger, Bernard <bernard.iremonger at intel.com>; Qiu, Michael
> <michael.qiu at intel.com>; dev at dpdk.org
> Subject: RE: [dpdk-dev] [PATCH] librte_ether: fix crashes in rte_ethdev
> functions.
> 
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Iremonger,
> > Bernard
> > Sent: Monday, December 21, 2015 11:40 AM
> > To: Qiu, Michael; dev at dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH] librte_ether: fix crashes in rte_ethdev
> functions.
> >
> > Hi Michael,
> >
> > > -----Original Message-----
> > > From: Qiu, Michael
> > > Sent: Monday, December 21, 2015 9:03 AM
> > > To: Iremonger, Bernard <bernard.iremonger at intel.com>; dev at dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH] librte_ether: fix crashes in
> > > rte_ethdev functions.
> > >
> > > On 2015/12/18 1:24, Bernard Iremonger wrote:
> > > > The nb_rx_queues and nb_tx_queues are initialised before the
> > > > tx_queue and rx_queue arrays are allocated. The arrays are
> > > > allocated when the ethdev port is started.
> > > >
> > > > If any of the following functions are called before the ethdev
> > > > port is started there is a segmentation fault:
> > > >
> > > > rte_eth_stats_get
> > > > rte_eth_stats_reset
> > > > rte_eth_xstats_get
> > > > rte_eth_xstats_reset
> > > >
> > > > Fixes: af75078fece3 ("first public release")
> > > > Fixes: ce757f5c9a4d ("ethdev: new method to retrieve extended
> > > > statistics")
> > > > Fixes: d4fef8b0d5e5 ("ethdev: expose generic and driver specific
> > > > stats in xstats")
> > > > Signed-off-by: Bernard Iremonger <bernard.iremonger at intel.com>
> > > > ---
> > > >  lib/librte_ether/rte_ethdev.c | 16 ++++++++++++----
> > > >  1 file changed, 12 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/lib/librte_ether/rte_ethdev.c
> > > > b/lib/librte_ether/rte_ethdev.c index ed971b4..a0ee84d 100644
> > > > --- a/lib/librte_ether/rte_ethdev.c
> > > > +++ b/lib/librte_ether/rte_ethdev.c
> > > > @@ -1441,7 +1441,10 @@ rte_eth_stats_get(uint8_t port_id, struct
> > > rte_eth_stats *stats)
> > > >  	memset(stats, 0, sizeof(*stats));
> > > >
> > > >  	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -
> > > ENOTSUP);
> > > > -	(*dev->dev_ops->stats_get)(dev, stats);
> > > > +
> > > > +	if (dev->data->dev_started)
> > > > +		(*dev->dev_ops->stats_get)(dev, stats);
> > > > +
> 
> So why it would be no possible now to get statistics on the stopped device?
> Konstantin

<snip>

I did not consider this scenario.
I need to rethink this patch.

Self NAK

Regards,

Bernard.


More information about the dev mailing list