DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/ice: add check for null-pointer dereference
@ 2024-11-14 11:35 Bruce Richardson
  2024-11-19 11:57 ` Stokes, Ian
  0 siblings, 1 reply; 3+ messages in thread
From: Bruce Richardson @ 2024-11-14 11:35 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

Although it should never occur that the teid (scheduler node id) value
for a txq is incorrect, put in a check for null following the scheduler
node lookup in ice_tm_setup_txq_node. This provides some additional
safety and should eliminate a coverity issue too.

Coverity issue: 448957
Fixes: 715d449a965b ("net/ice: enhance Tx scheduler hierarchy support")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/ice/ice_tm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c
index 18ac324a61..ff3a6cd77f 100644
--- a/drivers/net/ice/ice_tm.c
+++ b/drivers/net/ice/ice_tm.c
@@ -679,6 +679,10 @@ ice_tm_setup_txq_node(struct ice_pf *pf, struct ice_hw *hw, uint16_t qid, uint32
 	struct ice_sched_node *hw_node = ice_sched_find_node_by_teid(hw->port_info->root, teid);
 	struct ice_tm_node *sw_node = find_node(pf->tm_conf.root, qid);
 
+	/* bad node teid passed */
+	if (hw_node == NULL)
+		return -ENOENT;
+
 	/* not configured in hierarchy */
 	if (sw_node == NULL)
 		return 0;
-- 
2.43.0


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

* RE: [PATCH] net/ice: add check for null-pointer dereference
  2024-11-14 11:35 [PATCH] net/ice: add check for null-pointer dereference Bruce Richardson
@ 2024-11-19 11:57 ` Stokes, Ian
  2024-11-19 12:05   ` Bruce Richardson
  0 siblings, 1 reply; 3+ messages in thread
From: Stokes, Ian @ 2024-11-19 11:57 UTC (permalink / raw)
  To: Richardson, Bruce, dev; +Cc: Richardson, Bruce

> Although it should never occur that the teid (scheduler node id) value
> for a txq is incorrect, put in a check for null following the scheduler
> node lookup in ice_tm_setup_txq_node. This provides some additional
> safety and should eliminate a coverity issue too.
> 
> Coverity issue: 448957
> Fixes: 715d449a965b ("net/ice: enhance Tx scheduler hierarchy support")
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  drivers/net/ice/ice_tm.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c
> index 18ac324a61..ff3a6cd77f 100644
> --- a/drivers/net/ice/ice_tm.c
> +++ b/drivers/net/ice/ice_tm.c
> @@ -679,6 +679,10 @@ ice_tm_setup_txq_node(struct ice_pf *pf, struct
> ice_hw *hw, uint16_t qid, uint32
>  	struct ice_sched_node *hw_node = ice_sched_find_node_by_teid(hw-
> >port_info->root, teid);
>  	struct ice_tm_node *sw_node = find_node(pf->tm_conf.root, qid);
> 
> +	/* bad node teid passed */
> +	if (hw_node == NULL)
> +		return -ENOENT;
> +
>  	/* not configured in hierarchy */
>  	if (sw_node == NULL)
>  		return 0;

LGTM.

Acked-by: Ian Stokes <ian.stokes@intel.com>

> --
> 2.43.0


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

* Re: [PATCH] net/ice: add check for null-pointer dereference
  2024-11-19 11:57 ` Stokes, Ian
@ 2024-11-19 12:05   ` Bruce Richardson
  0 siblings, 0 replies; 3+ messages in thread
From: Bruce Richardson @ 2024-11-19 12:05 UTC (permalink / raw)
  To: Stokes, Ian; +Cc: dev

On Tue, Nov 19, 2024 at 11:57:15AM +0000, Stokes, Ian wrote:
> > Although it should never occur that the teid (scheduler node id) value
> > for a txq is incorrect, put in a check for null following the scheduler
> > node lookup in ice_tm_setup_txq_node. This provides some additional
> > safety and should eliminate a coverity issue too.
> > 
> > Coverity issue: 448957
> > Fixes: 715d449a965b ("net/ice: enhance Tx scheduler hierarchy support")
> > 
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
> >  drivers/net/ice/ice_tm.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c
> > index 18ac324a61..ff3a6cd77f 100644
> > --- a/drivers/net/ice/ice_tm.c
> > +++ b/drivers/net/ice/ice_tm.c
> > @@ -679,6 +679,10 @@ ice_tm_setup_txq_node(struct ice_pf *pf, struct
> > ice_hw *hw, uint16_t qid, uint32
> >  	struct ice_sched_node *hw_node = ice_sched_find_node_by_teid(hw-
> > >port_info->root, teid);
> >  	struct ice_tm_node *sw_node = find_node(pf->tm_conf.root, qid);
> > 
> > +	/* bad node teid passed */
> > +	if (hw_node == NULL)
> > +		return -ENOENT;
> > +
> >  	/* not configured in hierarchy */
> >  	if (sw_node == NULL)
> >  		return 0;
> 
> LGTM.
> 
> Acked-by: Ian Stokes <ian.stokes@intel.com>
> 
Applied to dpdk-next-net-intel.

/Bruce

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

end of thread, other threads:[~2024-11-19 12:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-14 11:35 [PATCH] net/ice: add check for null-pointer dereference Bruce Richardson
2024-11-19 11:57 ` Stokes, Ian
2024-11-19 12:05   ` 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).