DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix a segmentation fault in Rx
@ 2016-07-08 12:43 Nelio Laranjeiro
  2016-07-08 13:29 ` Adrien Mazarguil
  0 siblings, 1 reply; 3+ messages in thread
From: Nelio Laranjeiro @ 2016-07-08 12:43 UTC (permalink / raw)
  To: dev; +Cc: Adrien Mazarguil, Olga Shern, Yongseok Koh

Fixed issue could occur when a Mbuf starvation happens in a middle of
reception of a segmented packet, in such situation, the PMD has to release
all segments of such packet.  The end condition was wrong causing it to
free a Mbuf still handled by the NIC.

Fixes: 9964b965ad69 ("net/mlx5: re-add Rx scatter support")

Reported-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 drivers/net/mlx5/mlx5_rxtx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 0c352f3..3564937 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -1572,7 +1572,8 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
 		rte_prefetch0(wqe);
 		rep = rte_mbuf_raw_alloc(rxq->mp);
 		if (unlikely(rep == NULL)) {
-			while (pkt) {
+			while (pkt != seg) {
+				assert(pkt != (*rxq->elts)[idx]);
 				seg = NEXT(pkt);
 				rte_mbuf_refcnt_set(pkt, 0);
 				__rte_mbuf_raw_free(pkt);
-- 
2.1.4

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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix a segmentation fault in Rx
  2016-07-08 12:43 [dpdk-dev] [PATCH] net/mlx5: fix a segmentation fault in Rx Nelio Laranjeiro
@ 2016-07-08 13:29 ` Adrien Mazarguil
  2016-07-08 20:53   ` Bruce Richardson
  0 siblings, 1 reply; 3+ messages in thread
From: Adrien Mazarguil @ 2016-07-08 13:29 UTC (permalink / raw)
  To: Nelio Laranjeiro; +Cc: dev, Olga Shern, Yongseok Koh

On Fri, Jul 08, 2016 at 02:43:26PM +0200, Nelio Laranjeiro wrote:
> Fixed issue could occur when a Mbuf starvation happens in a middle of
> reception of a segmented packet, in such situation, the PMD has to release
> all segments of such packet.  The end condition was wrong causing it to
> free a Mbuf still handled by the NIC.
> 
> Fixes: 9964b965ad69 ("net/mlx5: re-add Rx scatter support")
> 
> Reported-by: Yongseok Koh <yskoh@mellanox.com>
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> ---
>  drivers/net/mlx5/mlx5_rxtx.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
> index 0c352f3..3564937 100644
> --- a/drivers/net/mlx5/mlx5_rxtx.c
> +++ b/drivers/net/mlx5/mlx5_rxtx.c
> @@ -1572,7 +1572,8 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
>  		rte_prefetch0(wqe);
>  		rep = rte_mbuf_raw_alloc(rxq->mp);
>  		if (unlikely(rep == NULL)) {
> -			while (pkt) {
> +			while (pkt != seg) {
> +				assert(pkt != (*rxq->elts)[idx]);
>  				seg = NEXT(pkt);
>  				rte_mbuf_refcnt_set(pkt, 0);
>  				__rte_mbuf_raw_free(pkt);
> -- 
> 2.1.4
> 

Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

-- 
Adrien Mazarguil
6WIND

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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix a segmentation fault in Rx
  2016-07-08 13:29 ` Adrien Mazarguil
@ 2016-07-08 20:53   ` Bruce Richardson
  0 siblings, 0 replies; 3+ messages in thread
From: Bruce Richardson @ 2016-07-08 20:53 UTC (permalink / raw)
  To: Nelio Laranjeiro, dev, Olga Shern, Yongseok Koh

On Fri, Jul 08, 2016 at 03:29:02PM +0200, Adrien Mazarguil wrote:
> On Fri, Jul 08, 2016 at 02:43:26PM +0200, Nelio Laranjeiro wrote:
> > Fixed issue could occur when a Mbuf starvation happens in a middle of
> > reception of a segmented packet, in such situation, the PMD has to release
> > all segments of such packet.  The end condition was wrong causing it to
> > free a Mbuf still handled by the NIC.
> > 
> > Fixes: 9964b965ad69 ("net/mlx5: re-add Rx scatter support")
> > 
> > Reported-by: Yongseok Koh <yskoh@mellanox.com>
> > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> > ---
> >  drivers/net/mlx5/mlx5_rxtx.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
> > index 0c352f3..3564937 100644
> > --- a/drivers/net/mlx5/mlx5_rxtx.c
> > +++ b/drivers/net/mlx5/mlx5_rxtx.c
> > @@ -1572,7 +1572,8 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
> >  		rte_prefetch0(wqe);
> >  		rep = rte_mbuf_raw_alloc(rxq->mp);
> >  		if (unlikely(rep == NULL)) {
> > -			while (pkt) {
> > +			while (pkt != seg) {
> > +				assert(pkt != (*rxq->elts)[idx]);
> >  				seg = NEXT(pkt);
> >  				rte_mbuf_refcnt_set(pkt, 0);
> >  				__rte_mbuf_raw_free(pkt);
> > -- 
> > 2.1.4
> > 
> 
> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> 
Applied to dpdk-next-net/rel_16_07

/Bruce

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-08 12:43 [dpdk-dev] [PATCH] net/mlx5: fix a segmentation fault in Rx Nelio Laranjeiro
2016-07-08 13:29 ` Adrien Mazarguil
2016-07-08 20:53   ` Bruce Richardson

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