net/ice: fix core dumped issue in switch filter

Message ID 20200429072516.65403-1-junyux.jiang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: xiaolong ye
Headers
Series net/ice: fix core dumped issue in switch filter |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance fail Performance Testing issues
ci/iol-nxp-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Junyu Jiang April 29, 2020, 7:25 a.m. UTC
  The number of queues in queue group should be checked before
using it to avoid NULL pointer. This patch fixed the issue.

Fixes: 47d460d63233 ("net/ice: rework switch filter")
Cc: stable@dpdk.org

Signed-off-by: Junyu Jiang <junyux.jiang@intel.com>
---
 drivers/net/ice/ice_switch_filter.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Qiming Yang April 30, 2020, 6:52 a.m. UTC | #1
Hi, 
I don't understand your fix log, which pointer is NULL?

Qiming

> -----Original Message-----
> From: Jiang, JunyuX <junyux.jiang@intel.com>
> Sent: Wednesday, April 29, 2020 15:25
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Jiang, JunyuX
> <junyux.jiang@intel.com>; stable@dpdk.org
> Subject: [PATCH] net/ice: fix core dumped issue in switch filter
> 
> The number of queues in queue group should be checked before using it to
> avoid NULL pointer. This patch fixed the issue.
> 
> Fixes: 47d460d63233 ("net/ice: rework switch filter")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Junyu Jiang <junyux.jiang@intel.com>
> ---
>  drivers/net/ice/ice_switch_filter.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ice/ice_switch_filter.c
> b/drivers/net/ice/ice_switch_filter.c
> index 179430136..c2762e331 100644
> --- a/drivers/net/ice/ice_switch_filter.c
> +++ b/drivers/net/ice/ice_switch_filter.c
> @@ -1296,6 +1296,8 @@ ice_switch_parse_action(struct ice_pf *pf,
>  		switch (action_type) {
>  		case RTE_FLOW_ACTION_TYPE_RSS:
>  			act_qgrop = action->conf;
> +			if (act_qgrop->queue_num <= 1)
> +				goto error;
>  			rule_info->sw_act.fltr_act =
>  				ICE_FWD_TO_QGRP;
>  			rule_info->sw_act.fwd_id.q_id =
> --
> 2.17.1
  
Junyu Jiang April 30, 2020, 7:42 a.m. UTC | #2
Hi Qiming,

> -----Original Message-----
> From: Yang, Qiming <qiming.yang@intel.com>
> Sent: Thursday, April 30, 2020 2:53 PM
> To: Jiang, JunyuX <junyux.jiang@intel.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: RE: [PATCH] net/ice: fix core dumped issue in switch filter
> 
> Hi,
> I don't understand your fix log, which pointer is NULL?
> 
The act_qgrop->queue is NULL if act_qgrop->queue_num is 0.

Thanks
Junyu
  
Xiao, QimaiX April 30, 2020, 9:09 a.m. UTC | #3
Tested-by: Xiao, QimaiX <qimaix.xiao@intel.com>

Regards,
Xiao Qimai


> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Junyu Jiang
> Sent: Wednesday, April 29, 2020 3:25 PM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Jiang, JunyuX
> <junyux.jiang@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/ice: fix core dumped issue in switch filter
> 
> The number of queues in queue group should be checked before using it to
> avoid NULL pointer. This patch fixed the issue.
> 
> Fixes: 47d460d63233 ("net/ice: rework switch filter")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Junyu Jiang <junyux.jiang@intel.com>
> ---
>  drivers/net/ice/ice_switch_filter.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ice/ice_switch_filter.c
> b/drivers/net/ice/ice_switch_filter.c
> index 179430136..c2762e331 100644
> --- a/drivers/net/ice/ice_switch_filter.c
> +++ b/drivers/net/ice/ice_switch_filter.c
> @@ -1296,6 +1296,8 @@ ice_switch_parse_action(struct ice_pf *pf,
>  		switch (action_type) {
>  		case RTE_FLOW_ACTION_TYPE_RSS:
>  			act_qgrop = action->conf;
> +			if (act_qgrop->queue_num <= 1)
> +				goto error;
>  			rule_info->sw_act.fltr_act =
>  				ICE_FWD_TO_QGRP;
>  			rule_info->sw_act.fwd_id.q_id =
> --
> 2.17.1
  

Patch

diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index 179430136..c2762e331 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -1296,6 +1296,8 @@  ice_switch_parse_action(struct ice_pf *pf,
 		switch (action_type) {
 		case RTE_FLOW_ACTION_TYPE_RSS:
 			act_qgrop = action->conf;
+			if (act_qgrop->queue_num <= 1)
+				goto error;
 			rule_info->sw_act.fltr_act =
 				ICE_FWD_TO_QGRP;
 			rule_info->sw_act.fwd_id.q_id =