All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: fix packet type and offload flags in Rx
@ 2016-07-07 16:34 Maxime Leroy
  2016-07-08  7:09 ` Adrien Mazarguil
  0 siblings, 1 reply; 3+ messages in thread
From: Maxime Leroy @ 2016-07-07 16:34 UTC (permalink / raw)
  To: dev

In mlx5 rx function, the packet_type and ol_flags mbuf fields are not
properly initialized when no rx offload feature is enabled (checksum, l2
tun checksum, vlan_strip, crc). Thus, these fields can have a value
different of 0 depending on their value when the mbuf was freed.

This can result in an incorrect application behavior if invalid
ol_flags/ptype are set, or memory corruptions if IND_ATTACHED_MBUF is
set in ol_flags.

Fixes: 081f7eae242e ("mlx5: process offload flags only when requested")

Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
---
 drivers/net/mlx5/mlx5_rxtx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 0c352f3f..4132fd74 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -1599,6 +1599,8 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
 			pkt = seg;
 			assert(len >= (rxq->crc_present << 2));
 			/* Update packet information. */
+			pkt->packet_type = 0;
+			pkt->ol_flags = 0;
 			if (rxq->csum | rxq->csum_l2tun | rxq->vlan_strip |
 			    rxq->crc_present) {
 				if (rxq->csum) {
-- 
2.1.4

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

* Re: [PATCH] net/mlx5: fix packet type and offload flags in Rx
  2016-07-07 16:34 [PATCH] net/mlx5: fix packet type and offload flags in Rx Maxime Leroy
@ 2016-07-08  7:09 ` Adrien Mazarguil
  2016-07-08 20:49   ` Bruce Richardson
  0 siblings, 1 reply; 3+ messages in thread
From: Adrien Mazarguil @ 2016-07-08  7:09 UTC (permalink / raw)
  To: Maxime Leroy; +Cc: dev

On Thu, Jul 07, 2016 at 06:34:45PM +0200, Maxime Leroy wrote:
> In mlx5 rx function, the packet_type and ol_flags mbuf fields are not
> properly initialized when no rx offload feature is enabled (checksum, l2
> tun checksum, vlan_strip, crc). Thus, these fields can have a value
> different of 0 depending on their value when the mbuf was freed.
> 
> This can result in an incorrect application behavior if invalid
> ol_flags/ptype are set, or memory corruptions if IND_ATTACHED_MBUF is
> set in ol_flags.
> 
> Fixes: 081f7eae242e ("mlx5: process offload flags only when requested")
> 
> Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
> ---
>  drivers/net/mlx5/mlx5_rxtx.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
> index 0c352f3f..4132fd74 100644
> --- a/drivers/net/mlx5/mlx5_rxtx.c
> +++ b/drivers/net/mlx5/mlx5_rxtx.c
> @@ -1599,6 +1599,8 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
>  			pkt = seg;
>  			assert(len >= (rxq->crc_present << 2));
>  			/* Update packet information. */
> +			pkt->packet_type = 0;
> +			pkt->ol_flags = 0;
>  			if (rxq->csum | rxq->csum_l2tun | rxq->vlan_strip |
>  			    rxq->crc_present) {
>  				if (rxq->csum) {
> -- 
> 2.1.4
> 

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

-- 
Adrien Mazarguil
6WIND

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

* Re: [PATCH] net/mlx5: fix packet type and offload flags in Rx
  2016-07-08  7:09 ` Adrien Mazarguil
@ 2016-07-08 20:49   ` Bruce Richardson
  0 siblings, 0 replies; 3+ messages in thread
From: Bruce Richardson @ 2016-07-08 20:49 UTC (permalink / raw)
  To: Maxime Leroy, dev

On Fri, Jul 08, 2016 at 09:09:32AM +0200, Adrien Mazarguil wrote:
> On Thu, Jul 07, 2016 at 06:34:45PM +0200, Maxime Leroy wrote:
> > In mlx5 rx function, the packet_type and ol_flags mbuf fields are not
> > properly initialized when no rx offload feature is enabled (checksum, l2
> > tun checksum, vlan_strip, crc). Thus, these fields can have a value
> > different of 0 depending on their value when the mbuf was freed.
> > 
> > This can result in an incorrect application behavior if invalid
> > ol_flags/ptype are set, or memory corruptions if IND_ATTACHED_MBUF is
> > set in ol_flags.
> > 
> > Fixes: 081f7eae242e ("mlx5: process offload flags only when requested")
> > 
> > Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
> > ---
> >  drivers/net/mlx5/mlx5_rxtx.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
> > index 0c352f3f..4132fd74 100644
> > --- a/drivers/net/mlx5/mlx5_rxtx.c
> > +++ b/drivers/net/mlx5/mlx5_rxtx.c
> > @@ -1599,6 +1599,8 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
> >  			pkt = seg;
> >  			assert(len >= (rxq->crc_present << 2));
> >  			/* Update packet information. */
> > +			pkt->packet_type = 0;
> > +			pkt->ol_flags = 0;
> >  			if (rxq->csum | rxq->csum_l2tun | rxq->vlan_strip |
> >  			    rxq->crc_present) {
> >  				if (rxq->csum) {
> > -- 
> > 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:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-07 16:34 [PATCH] net/mlx5: fix packet type and offload flags in Rx Maxime Leroy
2016-07-08  7:09 ` Adrien Mazarguil
2016-07-08 20:49   ` Bruce Richardson

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.