DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/enic: fix potential null dereference in flow mask check
@ 2026-07-07  8:58 Alexey Simakov
  2026-07-09  9:57 ` Hyong Youb Kim (hyonkim)
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Simakov @ 2026-07-07  8:58 UTC (permalink / raw)
  To: Thomas Monjalon, John Daley, Hyong Youb Kim, Nelson Escobar
  Cc: dev, stable, Alexey Simakov

The functions enic_copy_item_ipv4_v1(), enic_copy_item_udp_v1(), and
enic_copy_item_tcp_v1() each initialize a local 'mask' variable from
item->mask and substitute it with a hardcoded mask if NULL. However,
the subsequent mask_exact_match() call uses item->mask directly
instead of the local 'mask' variable, which will dereference NULL
when item->mask is NULL.

Use the local 'mask' variable (which has been validated and possibly
substituted) instead of item->mask.

Fixes: aa3d2ff82198 ("net/enic: flow API for Legacy NICs")
Cc: stable@dpdk.org

Signed-off-by: Alexey Simakov <bigalex934@gmail.com>
---
 .mailmap                     | 1 +
 drivers/net/enic/enic_flow.c | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/.mailmap b/.mailmap
index 4b5eb0c841..b154cd25a9 100644
--- a/.mailmap
+++ b/.mailmap
@@ -71,6 +71,7 @@ Alexander Skorichenko <askorichenko@netgate.com>
 Alexander Solganik <solganik@gmail.com>
 Alexander V Gutkin <alexander.v.gutkin@intel.com>
 Alexandre Ferrieux <alexandre.ferrieux@orange.com>
+Alexey Simakov <bigalex934@gmail.com>
 Alexey Kardashevskiy <aik@ozlabs.ru>
 Alfredo Cardigliano <cardigliano@ntop.org>
 Ali Alnubani <alialnu@nvidia.com> <alialnu@mellanox.com>
diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c
index 758000ea21..539b0eb725 100644
--- a/drivers/net/enic/enic_flow.c
+++ b/drivers/net/enic/enic_flow.c
@@ -407,7 +407,7 @@ enic_copy_item_ipv4_v1(struct copy_item_args *arg)
 
 	/* check that the supplied mask exactly matches capability */
 	if (!mask_exact_match((const uint8_t *)&supported_mask,
-			      (const uint8_t *)item->mask, sizeof(*mask))) {
+			      (const uint8_t *)mask, sizeof(*mask))) {
 		ENICPMD_LOG(ERR, "IPv4 exact match mask");
 		return ENOTSUP;
 	}
@@ -445,7 +445,7 @@ enic_copy_item_udp_v1(struct copy_item_args *arg)
 
 	/* check that the supplied mask exactly matches capability */
 	if (!mask_exact_match((const uint8_t *)&supported_mask,
-			      (const uint8_t *)item->mask, sizeof(*mask))) {
+			      (const uint8_t *)mask, sizeof(*mask))) {
 		ENICPMD_LOG(ERR, "UDP exact match mask");
 		return ENOTSUP;
 	}
@@ -484,7 +484,7 @@ enic_copy_item_tcp_v1(struct copy_item_args *arg)
 
 	/* check that the supplied mask exactly matches capability */
 	if (!mask_exact_match((const uint8_t *)&supported_mask,
-			     (const uint8_t *)item->mask, sizeof(*mask))) {
+			     (const uint8_t *)mask, sizeof(*mask))) {
 		ENICPMD_LOG(ERR, "TCP exact match mask");
 		return ENOTSUP;
 	}
-- 
2.34.1


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

* RE: [PATCH] net/enic: fix potential null dereference in flow mask check
  2026-07-07  8:58 [PATCH] net/enic: fix potential null dereference in flow mask check Alexey Simakov
@ 2026-07-09  9:57 ` Hyong Youb Kim (hyonkim)
  2026-07-09 12:03   ` Thomas Monjalon
  2026-07-10 11:29   ` Thomas Monjalon
  0 siblings, 2 replies; 5+ messages in thread
From: Hyong Youb Kim (hyonkim) @ 2026-07-09  9:57 UTC (permalink / raw)
  To: Alexey Simakov, Thomas Monjalon, John Daley (johndale),
	Nelson Escobar (neescoba)
  Cc: dev@dpdk.org, stable@dpdk.org

> -----Original Message-----
> From: Alexey Simakov <bigalex934@gmail.com>
> Sent: Tuesday, July 7, 2026 5:59 PM
> To: Thomas Monjalon <thomas@monjalon.net>; John Daley (johndale)
> <johndale@cisco.com>; Hyong Youb Kim (hyonkim) <hyonkim@cisco.com>;
> Nelson Escobar (neescoba) <neescoba@cisco.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Alexey Simakov
> <bigalex934@gmail.com>
> Subject: [PATCH] net/enic: fix potential null dereference in flow mask check
> 
> The functions enic_copy_item_ipv4_v1(), enic_copy_item_udp_v1(), and
> enic_copy_item_tcp_v1() each initialize a local 'mask' variable from
> item->mask and substitute it with a hardcoded mask if NULL. However,
> the subsequent mask_exact_match() call uses item->mask directly
> instead of the local 'mask' variable, which will dereference NULL
> when item->mask is NULL.
> 
> Use the local 'mask' variable (which has been validated and possibly
> substituted) instead of item->mask.
> 
> Fixes: aa3d2ff82198 ("net/enic: flow API for Legacy NICs")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alexey Simakov <bigalex934@gmail.com>
> ---
>  .mailmap                     | 1 +
>  drivers/net/enic/enic_flow.c | 6 +++---
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/.mailmap b/.mailmap
> index 4b5eb0c841..b154cd25a9 100644
> --- a/.mailmap
> +++ b/.mailmap
> @@ -71,6 +71,7 @@ Alexander Skorichenko <askorichenko@netgate.com>
>  Alexander Solganik <solganik@gmail.com>
>  Alexander V Gutkin <alexander.v.gutkin@intel.com>
>  Alexandre Ferrieux <alexandre.ferrieux@orange.com>
> +Alexey Simakov <bigalex934@gmail.com>
>  Alexey Kardashevskiy <aik@ozlabs.ru>
>  Alfredo Cardigliano <cardigliano@ntop.org>
>  Ali Alnubani <alialnu@nvidia.com> <alialnu@mellanox.com>
> diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c
> index 758000ea21..539b0eb725 100644
> --- a/drivers/net/enic/enic_flow.c
> +++ b/drivers/net/enic/enic_flow.c
> @@ -407,7 +407,7 @@ enic_copy_item_ipv4_v1(struct copy_item_args *arg)
> 
>  	/* check that the supplied mask exactly matches capability */
>  	if (!mask_exact_match((const uint8_t *)&supported_mask,
> -			      (const uint8_t *)item->mask, sizeof(*mask))) {
> +			      (const uint8_t *)mask, sizeof(*mask))) {
>  		ENICPMD_LOG(ERR, "IPv4 exact match mask");
>  		return ENOTSUP;
>  	}
> @@ -445,7 +445,7 @@ enic_copy_item_udp_v1(struct copy_item_args *arg)
> 
>  	/* check that the supplied mask exactly matches capability */
>  	if (!mask_exact_match((const uint8_t *)&supported_mask,
> -			      (const uint8_t *)item->mask, sizeof(*mask))) {
> +			      (const uint8_t *)mask, sizeof(*mask))) {
>  		ENICPMD_LOG(ERR, "UDP exact match mask");
>  		return ENOTSUP;
>  	}
> @@ -484,7 +484,7 @@ enic_copy_item_tcp_v1(struct copy_item_args *arg)
> 
>  	/* check that the supplied mask exactly matches capability */
>  	if (!mask_exact_match((const uint8_t *)&supported_mask,
> -			     (const uint8_t *)item->mask, sizeof(*mask))) {
> +			     (const uint8_t *)mask, sizeof(*mask))) {
>  		ENICPMD_LOG(ERR, "TCP exact match mask");
>  		return ENOTSUP;
>  	}
> --
> 2.34.1

Can you remove .mailmap diff?

The enic patch looks like a valid fix.
Acked-by: Hyong Youb Kim <hyonkim@cisco.com>

Thanks.
-Hyong


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

* Re: [PATCH] net/enic: fix potential null dereference in flow mask check
  2026-07-09  9:57 ` Hyong Youb Kim (hyonkim)
@ 2026-07-09 12:03   ` Thomas Monjalon
  2026-07-09 12:07     ` Hyong Youb Kim (hyonkim)
  2026-07-10 11:29   ` Thomas Monjalon
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Monjalon @ 2026-07-09 12:03 UTC (permalink / raw)
  To: Hyong Youb Kim (hyonkim)
  Cc: Alexey Simakov, John Daley (johndale), Nelson Escobar (neescoba),
	dev@dpdk.org, stable@dpdk.org

09/07/2026 11:57, Hyong Youb Kim (hyonkim):
> From: Alexey Simakov <bigalex934@gmail.com>
> > --- a/.mailmap
> > +++ b/.mailmap
> > @@ -71,6 +71,7 @@ Alexander Skorichenko <askorichenko@netgate.com>
> >  Alexander Solganik <solganik@gmail.com>
> >  Alexander V Gutkin <alexander.v.gutkin@intel.com>
> >  Alexandre Ferrieux <alexandre.ferrieux@orange.com>
> > +Alexey Simakov <bigalex934@gmail.com>
> >  Alexey Kardashevskiy <aik@ozlabs.ru>
> >  Alfredo Cardigliano <cardigliano@ntop.org>
> >  Ali Alnubani <alialnu@nvidia.com> <alialnu@mellanox.com>
> 
> Can you remove .mailmap diff?

Why are you asking that?
Any new contributor must be in this file.
If it is not done, I add it manually in the commit.



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

* RE: [PATCH] net/enic: fix potential null dereference in flow mask check
  2026-07-09 12:03   ` Thomas Monjalon
@ 2026-07-09 12:07     ` Hyong Youb Kim (hyonkim)
  0 siblings, 0 replies; 5+ messages in thread
From: Hyong Youb Kim (hyonkim) @ 2026-07-09 12:07 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Alexey Simakov, John Daley (johndale), Nelson Escobar (neescoba),
	dev@dpdk.org, stable@dpdk.org



> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Thursday, July 9, 2026 9:04 PM
> To: Hyong Youb Kim (hyonkim) <hyonkim@cisco.com>
> Cc: Alexey Simakov <bigalex934@gmail.com>; John Daley (johndale)
> <johndale@cisco.com>; Nelson Escobar (neescoba) <neescoba@cisco.com>;
> dev@dpdk.org; stable@dpdk.org
> Subject: Re: [PATCH] net/enic: fix potential null dereference in flow mask check
> 
> 09/07/2026 11:57, Hyong Youb Kim (hyonkim):
> > From: Alexey Simakov <bigalex934@gmail.com>
> > > --- a/.mailmap
> > > +++ b/.mailmap
> > > @@ -71,6 +71,7 @@ Alexander Skorichenko <askorichenko@netgate.com>
> > >  Alexander Solganik <solganik@gmail.com>
> > >  Alexander V Gutkin <alexander.v.gutkin@intel.com>
> > >  Alexandre Ferrieux <alexandre.ferrieux@orange.com>
> > > +Alexey Simakov <bigalex934@gmail.com>
> > >  Alexey Kardashevskiy <aik@ozlabs.ru>
> > >  Alfredo Cardigliano <cardigliano@ntop.org>
> > >  Ali Alnubani <alialnu@nvidia.com> <alialnu@mellanox.com>
> >
> > Can you remove .mailmap diff?
> 
> Why are you asking that?
> Any new contributor must be in this file.
> If it is not done, I add it manually in the commit.
> 

My bad. I did not know.

Thanks.
-Hyong


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

* Re: [PATCH] net/enic: fix potential null dereference in flow mask check
  2026-07-09  9:57 ` Hyong Youb Kim (hyonkim)
  2026-07-09 12:03   ` Thomas Monjalon
@ 2026-07-10 11:29   ` Thomas Monjalon
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2026-07-10 11:29 UTC (permalink / raw)
  To: Alexey Simakov
  Cc: John Daley (johndale), Nelson Escobar (neescoba), dev,
	stable@dpdk.org, Hyong Youb Kim (hyonkim)

> > The functions enic_copy_item_ipv4_v1(), enic_copy_item_udp_v1(), and
> > enic_copy_item_tcp_v1() each initialize a local 'mask' variable from
> > item->mask and substitute it with a hardcoded mask if NULL. However,
> > the subsequent mask_exact_match() call uses item->mask directly
> > instead of the local 'mask' variable, which will dereference NULL
> > when item->mask is NULL.
> > 
> > Use the local 'mask' variable (which has been validated and possibly
> > substituted) instead of item->mask.
> > 
> > Fixes: aa3d2ff82198 ("net/enic: flow API for Legacy NICs")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Alexey Simakov <bigalex934@gmail.com>
> > ---
> The enic patch looks like a valid fix.
> Acked-by: Hyong Youb Kim <hyonkim@cisco.com>

Applied, thanks.



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

end of thread, other threads:[~2026-07-10 11:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-07  8:58 [PATCH] net/enic: fix potential null dereference in flow mask check Alexey Simakov
2026-07-09  9:57 ` Hyong Youb Kim (hyonkim)
2026-07-09 12:03   ` Thomas Monjalon
2026-07-09 12:07     ` Hyong Youb Kim (hyonkim)
2026-07-10 11:29   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox