diff mbox series

[v3,01/10] net/bnxt: handle flow create failure

Message ID 20200114051435.46093-2-ajit.khaparde@broadcom.com (mailing list archive)
State Superseded, archived
Delegated to: Ajit Khaparde
Headers show
Series bnxt patchset with bug fixes | expand

Checks

Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Ajit Khaparde Jan. 14, 2020, 5:14 a.m. UTC
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

If flow create fails due to not enough filter resources,
driver does not populate the rte_flow_error using
rte_flow_error_set().

Since "rte_errno" could have garbage value and is not relaiable,
it could cause a segfault in the stack in port_flow_complain().

Fix it to set rte_flow_error using rte_flow_error_set()
when flow create fails due to not enough filter resources.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_flow.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Ferruh Yigit Jan. 14, 2020, 12:59 p.m. UTC | #1
On 1/14/2020 5:14 AM, Ajit Khaparde wrote:
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> 
> If flow create fails due to not enough filter resources,
> driver does not populate the rte_flow_error using
> rte_flow_error_set().
> 
> Since "rte_errno" could have garbage value and is not relaiable,
> it could cause a segfault in the stack in port_flow_complain().
> 
> Fix it to set rte_flow_error using rte_flow_error_set()
> when flow create fails due to not enough filter resources.

Hi Ajit, Kalesh,

In patch title, 'handle' seems means fix, can you please prefer the 'fix' since
it become kind of keyword to define the patch content. This also helps us
missing the "Fixes: " tag as it has been here.

Thanks,
ferruh

> 
> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  drivers/net/bnxt/bnxt_flow.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
> index cde1fa41c..5564c5363 100644
> --- a/drivers/net/bnxt/bnxt_flow.c
> +++ b/drivers/net/bnxt/bnxt_flow.c
> @@ -1702,7 +1702,9 @@ bnxt_flow_create(struct rte_eth_dev *dev,
>  
>  	filter = bnxt_get_unused_filter(bp);
>  	if (filter == NULL) {
> -		PMD_DRV_LOG(ERR, "Not enough resources for a new flow.\n");
> +		rte_flow_error_set(error, ENOSPC,
> +				   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
> +				   "Not enough resources for a new flow");
>  		goto free_flow;
>  	}
>  
>
diff mbox series

Patch

diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index cde1fa41c..5564c5363 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -1702,7 +1702,9 @@  bnxt_flow_create(struct rte_eth_dev *dev,
 
 	filter = bnxt_get_unused_filter(bp);
 	if (filter == NULL) {
-		PMD_DRV_LOG(ERR, "Not enough resources for a new flow.\n");
+		rte_flow_error_set(error, ENOSPC,
+				   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+				   "Not enough resources for a new flow");
 		goto free_flow;
 	}