* [dpdk-dev] [PATCH v2 2/4] net/i40e: add null point check and fix mem leak
2017-12-20 10:23 [dpdk-dev] [PATCH v2 1/4] net/dpaa: add null point check and fix mem leak Yong Wang
@ 2017-12-20 10:23 ` Yong Wang
2017-12-27 6:41 ` Xing, Beilei
2017-12-20 10:23 ` [dpdk-dev] [PATCH v2 3/4] net/e1000: add null point check for rte_zmalloc Yong Wang
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Yong Wang @ 2017-12-20 10:23 UTC (permalink / raw)
To: hemant.agrawal, beilei.xing, wenzhuo.lu, john.griffin; +Cc: dev, Yong Wang
Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
---
v2:
* Fix code style warning.
---
drivers/net/i40e/i40e_ethdev.c | 32 ++++++++++++++++++++++++++++++++
drivers/net/i40e/i40e_fdir.c | 7 +++++++
2 files changed, 39 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 811cc9f..f871474 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -7036,11 +7036,13 @@ struct i40e_tunnel_filter *
node = i40e_sw_tunnel_filter_lookup(tunnel_rule, &check_filter.input);
if (add && node) {
PMD_DRV_LOG(ERR, "Conflict with existing tunnel rules!");
+ rte_free(cld_filter);
return -EINVAL;
}
if (!add && !node) {
PMD_DRV_LOG(ERR, "There's no corresponding tunnel filter!");
+ rte_free(cld_filter);
return -EINVAL;
}
@@ -7049,16 +7051,26 @@ struct i40e_tunnel_filter *
vsi->seid, &cld_filter->element, 1);
if (ret < 0) {
PMD_DRV_LOG(ERR, "Failed to add a tunnel filter.");
+ rte_free(cld_filter);
return -ENOTSUP;
}
tunnel = rte_zmalloc("tunnel_filter", sizeof(*tunnel), 0);
+ if (tunnel == NULL) {
+ PMD_DRV_LOG(ERR, "Failed to alloc memory.");
+ rte_free(cld_filter);
+ return -ENOMEM;
+ }
+
rte_memcpy(tunnel, &check_filter, sizeof(check_filter));
ret = i40e_sw_tunnel_filter_insert(pf, tunnel);
+ if (ret < 0)
+ rte_free(tunnel);
} else {
ret = i40e_aq_remove_cloud_filters(hw, vsi->seid,
&cld_filter->element, 1);
if (ret < 0) {
PMD_DRV_LOG(ERR, "Failed to delete a tunnel filter.");
+ rte_free(cld_filter);
return -ENOTSUP;
}
ret = i40e_sw_tunnel_filter_del(pf, &node->input);
@@ -7486,6 +7498,7 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf)
else {
if (tunnel_filter->vf_id >= pf->vf_num) {
PMD_DRV_LOG(ERR, "Invalid argument.");
+ rte_free(cld_filter);
return -EINVAL;
}
vf = &pf->vfs[tunnel_filter->vf_id];
@@ -7500,11 +7513,13 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf)
node = i40e_sw_tunnel_filter_lookup(tunnel_rule, &check_filter.input);
if (add && node) {
PMD_DRV_LOG(ERR, "Conflict with existing tunnel rules!");
+ rte_free(cld_filter);
return -EINVAL;
}
if (!add && !node) {
PMD_DRV_LOG(ERR, "There's no corresponding tunnel filter!");
+ rte_free(cld_filter);
return -EINVAL;
}
@@ -7517,11 +7532,20 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf)
vsi->seid, &cld_filter->element, 1);
if (ret < 0) {
PMD_DRV_LOG(ERR, "Failed to add a tunnel filter.");
+ rte_free(cld_filter);
return -ENOTSUP;
}
tunnel = rte_zmalloc("tunnel_filter", sizeof(*tunnel), 0);
+ if (tunnel == NULL) {
+ PMD_DRV_LOG(ERR, "Failed to alloc memory.");
+ rte_free(cld_filter);
+ return -ENOMEM;
+ }
+
rte_memcpy(tunnel, &check_filter, sizeof(check_filter));
ret = i40e_sw_tunnel_filter_insert(pf, tunnel);
+ if (ret < 0)
+ rte_free(tunnel);
} else {
if (big_buffer)
ret = i40e_aq_remove_cloud_filters_big_buffer(
@@ -7531,6 +7555,7 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf)
&cld_filter->element, 1);
if (ret < 0) {
PMD_DRV_LOG(ERR, "Failed to delete a tunnel filter.");
+ rte_free(cld_filter);
return -ENOTSUP;
}
ret = i40e_sw_tunnel_filter_del(pf, &node->input);
@@ -9142,9 +9167,16 @@ struct i40e_ethertype_filter *
if (add) {
ethertype_filter = rte_zmalloc("ethertype_filter",
sizeof(*ethertype_filter), 0);
+ if (ethertype_filter == NULL) {
+ PMD_DRV_LOG(ERR, "Failed to alloc memory.");
+ return -ENOMEM;
+ }
+
rte_memcpy(ethertype_filter, &check_filter,
sizeof(check_filter));
ret = i40e_sw_ethertype_filter_insert(pf, ethertype_filter);
+ if (ret < 0)
+ rte_free(ethertype_filter);
} else {
ret = i40e_sw_ethertype_filter_del(pf, &node->input);
}
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 3d7170d..9ce25b2 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1612,8 +1612,15 @@ static int i40e_sw_fdir_filter_insert(struct i40e_pf *pf,
if (add) {
fdir_filter = rte_zmalloc("fdir_filter",
sizeof(*fdir_filter), 0);
+ if (fdir_filter == NULL) {
+ PMD_DRV_LOG(ERR, "Failed to alloc memory.");
+ return -ENOMEM;
+ }
+
rte_memcpy(fdir_filter, &check_filter, sizeof(check_filter));
ret = i40e_sw_fdir_filter_insert(pf, fdir_filter);
+ if (ret < 0)
+ rte_free(fdir_filter);
} else {
ret = i40e_sw_fdir_filter_del(pf, &node->fdir.input);
}
--
1.8.3.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/4] net/i40e: add null point check and fix mem leak
2017-12-20 10:23 ` [dpdk-dev] [PATCH v2 2/4] net/i40e: " Yong Wang
@ 2017-12-27 6:41 ` Xing, Beilei
0 siblings, 0 replies; 10+ messages in thread
From: Xing, Beilei @ 2017-12-27 6:41 UTC (permalink / raw)
To: Yong Wang, hemant.agrawal, Lu, Wenzhuo, Griffin, John; +Cc: dev
> -----Original Message-----
> From: Yong Wang [mailto:wang.yong19@zte.com.cn]
> Sent: Wednesday, December 20, 2017 6:23 PM
> To: hemant.agrawal@nxp.com; Xing, Beilei <beilei.xing@intel.com>; Lu,
> Wenzhuo <wenzhuo.lu@intel.com>; Griffin, John <john.griffin@intel.com>
> Cc: dev@dpdk.org; Yong Wang <wang.yong19@zte.com.cn>
> Subject: [PATCH v2 2/4] net/i40e: add null point check and fix mem leak
>
> Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
Thanks for the patch.
Acked-by: Beilei Xing <beilei.xing@intel.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH v2 3/4] net/e1000: add null point check for rte_zmalloc
2017-12-20 10:23 [dpdk-dev] [PATCH v2 1/4] net/dpaa: add null point check and fix mem leak Yong Wang
2017-12-20 10:23 ` [dpdk-dev] [PATCH v2 2/4] net/i40e: " Yong Wang
@ 2017-12-20 10:23 ` Yong Wang
2017-12-20 10:23 ` [dpdk-dev] [PATCH v2 4/4] crypto/qat: add null point check and fix mem leak Yong Wang
` (2 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Yong Wang @ 2017-12-20 10:23 UTC (permalink / raw)
To: hemant.agrawal, beilei.xing, wenzhuo.lu, john.griffin; +Cc: dev, Yong Wang
Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
---
drivers/net/e1000/igb_flow.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c
index 22bad26..057579b 100644
--- a/drivers/net/e1000/igb_flow.c
+++ b/drivers/net/e1000/igb_flow.c
@@ -1345,6 +1345,11 @@
if (!ret) {
ntuple_filter_ptr = rte_zmalloc("igb_ntuple_filter",
sizeof(struct igb_ntuple_filter_ele), 0);
+ if (!ntuple_filter_ptr) {
+ PMD_DRV_LOG(ERR, "failed to allocate memory");
+ goto out;
+ }
+
rte_memcpy(&ntuple_filter_ptr->filter_info,
&ntuple_filter,
sizeof(struct rte_eth_ntuple_filter));
@@ -1367,6 +1372,11 @@
ethertype_filter_ptr = rte_zmalloc(
"igb_ethertype_filter",
sizeof(struct igb_ethertype_filter_ele), 0);
+ if (!ethertype_filter_ptr) {
+ PMD_DRV_LOG(ERR, "failed to allocate memory");
+ goto out;
+ }
+
rte_memcpy(ðertype_filter_ptr->filter_info,
ðertype_filter,
sizeof(struct rte_eth_ethertype_filter));
@@ -1387,6 +1397,11 @@
if (!ret) {
syn_filter_ptr = rte_zmalloc("igb_syn_filter",
sizeof(struct igb_eth_syn_filter_ele), 0);
+ if (!syn_filter_ptr) {
+ PMD_DRV_LOG(ERR, "failed to allocate memory");
+ goto out;
+ }
+
rte_memcpy(&syn_filter_ptr->filter_info,
&syn_filter,
sizeof(struct rte_eth_syn_filter));
@@ -1408,6 +1423,11 @@
if (!ret) {
flex_filter_ptr = rte_zmalloc("igb_flex_filter",
sizeof(struct igb_flex_filter_ele), 0);
+ if (!flex_filter_ptr) {
+ PMD_DRV_LOG(ERR, "failed to allocate memory");
+ goto out;
+ }
+
rte_memcpy(&flex_filter_ptr->filter_info,
&flex_filter,
sizeof(struct rte_eth_flex_filter));
--
1.8.3.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH v2 4/4] crypto/qat: add null point check and fix mem leak
2017-12-20 10:23 [dpdk-dev] [PATCH v2 1/4] net/dpaa: add null point check and fix mem leak Yong Wang
2017-12-20 10:23 ` [dpdk-dev] [PATCH v2 2/4] net/i40e: " Yong Wang
2017-12-20 10:23 ` [dpdk-dev] [PATCH v2 3/4] net/e1000: add null point check for rte_zmalloc Yong Wang
@ 2017-12-20 10:23 ` Yong Wang
2017-12-20 12:22 ` Trahe, Fiona
2017-12-20 12:58 ` [dpdk-dev] [PATCH v2 1/4] net/dpaa: " Shreyansh Jain
2018-01-17 23:00 ` Thomas Monjalon
4 siblings, 1 reply; 10+ messages in thread
From: Yong Wang @ 2017-12-20 10:23 UTC (permalink / raw)
To: hemant.agrawal, beilei.xing, wenzhuo.lu, john.griffin; +Cc: dev, Yong Wang
Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
---
drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 10 ++++++++++
drivers/crypto/qat/qat_qp.c | 8 +++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
index db6c9a3..26f854c 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
+++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
@@ -359,6 +359,11 @@ static int qat_alg_do_precomputes(enum icp_qat_hw_auth_algo hash_alg,
in = rte_zmalloc("working mem for key",
ICP_QAT_HW_AES_XCBC_MAC_STATE2_SZ, 16);
+ if (in == NULL) {
+ PMD_DRV_LOG(ERR, "Failed to alloc memory");
+ return -ENOMEM;
+ }
+
rte_memcpy(in, qat_aes_xcbc_key_seed,
ICP_QAT_HW_AES_XCBC_MAC_STATE2_SZ);
for (x = 0; x < HASH_XCBC_PRECOMP_KEY_NUM; x++) {
@@ -389,6 +394,11 @@ static int qat_alg_do_precomputes(enum icp_qat_hw_auth_algo hash_alg,
ICP_QAT_HW_GALOIS_E_CTR0_SZ);
in = rte_zmalloc("working mem for key",
ICP_QAT_HW_GALOIS_H_SZ, 16);
+ if (in == NULL) {
+ PMD_DRV_LOG(ERR, "Failed to alloc memory");
+ return -ENOMEM;
+ }
+
memset(in, 0, ICP_QAT_HW_GALOIS_H_SZ);
if (AES_set_encrypt_key(auth_key, auth_keylen << 3,
&enc_key) != 0) {
diff --git a/drivers/crypto/qat/qat_qp.c b/drivers/crypto/qat/qat_qp.c
index ced3aa6..8c40c94 100644
--- a/drivers/crypto/qat/qat_qp.c
+++ b/drivers/crypto/qat/qat_qp.c
@@ -180,6 +180,11 @@ int qat_crypto_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
qp->op_cookies = rte_zmalloc("qat PMD op cookie pointer",
qp_conf->nb_descriptors * sizeof(*qp->op_cookies),
RTE_CACHE_LINE_SIZE);
+ if (qp->op_cookies == NULL) {
+ PMD_DRV_LOG(ERR, "Failed to alloc mem for cookie");
+ rte_free(qp);
+ return -ENOMEM;
+ }
qp->mmap_bar_addr = pci_dev->mem_resource[0].addr;
qp->inflights16 = 0;
@@ -221,7 +226,7 @@ int qat_crypto_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
for (i = 0; i < qp->nb_descriptors; i++) {
if (rte_mempool_get(qp->op_cookie_pool, &qp->op_cookies[i])) {
PMD_DRV_LOG(ERR, "QAT PMD Cannot get op_cookie");
- return -EFAULT;
+ goto create_err;
}
struct qat_crypto_op_cookie *sql_cookie =
@@ -246,6 +251,7 @@ int qat_crypto_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
return 0;
create_err:
+ rte_free(qp->op_cookies);
rte_free(qp);
return -EFAULT;
}
--
1.8.3.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH v2 4/4] crypto/qat: add null point check and fix mem leak
2017-12-20 10:23 ` [dpdk-dev] [PATCH v2 4/4] crypto/qat: add null point check and fix mem leak Yong Wang
@ 2017-12-20 12:22 ` Trahe, Fiona
0 siblings, 0 replies; 10+ messages in thread
From: Trahe, Fiona @ 2017-12-20 12:22 UTC (permalink / raw)
To: Yong Wang, hemant.agrawal, Xing, Beilei, Lu, Wenzhuo, Griffin, John; +Cc: dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yong Wang
> Sent: Wednesday, December 20, 2017 10:23 AM
> To: hemant.agrawal@nxp.com; Xing, Beilei <beilei.xing@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>; Griffin, John <john.griffin@intel.com>
> Cc: dev@dpdk.org; Yong Wang <wang.yong19@zte.com.cn>
> Subject: [dpdk-dev] [PATCH v2 4/4] crypto/qat: add null point check and fix mem leak
>
> Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/4] net/dpaa: add null point check and fix mem leak
2017-12-20 10:23 [dpdk-dev] [PATCH v2 1/4] net/dpaa: add null point check and fix mem leak Yong Wang
` (2 preceding siblings ...)
2017-12-20 10:23 ` [dpdk-dev] [PATCH v2 4/4] crypto/qat: add null point check and fix mem leak Yong Wang
@ 2017-12-20 12:58 ` Shreyansh Jain
2018-01-17 23:00 ` Thomas Monjalon
4 siblings, 0 replies; 10+ messages in thread
From: Shreyansh Jain @ 2017-12-20 12:58 UTC (permalink / raw)
To: Yong Wang, hemant.agrawal; +Cc: beilei.xing, wenzhuo.lu, john.griffin, dev
On Wednesday 20 December 2017 03:53 PM, Yong Wang wrote:
> Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
> ---
> drivers/net/dpaa/dpaa_ethdev.c | 36 +++++++++++++++++++++++++-----------
> 1 file changed, 25 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
> index cf5a2ec..06d680c 100644
> --- a/drivers/net/dpaa/dpaa_ethdev.c
> +++ b/drivers/net/dpaa/dpaa_ethdev.c
> @@ -877,12 +877,17 @@ static int dpaa_debug_queue_init(struct qman_fq *fq, uint32_t fqid)
>
Thanks for the fix!
Reviewed-By: Shreyansh Jain <shreyansh.jain@nxp.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/4] net/dpaa: add null point check and fix mem leak
2017-12-20 10:23 [dpdk-dev] [PATCH v2 1/4] net/dpaa: add null point check and fix mem leak Yong Wang
` (3 preceding siblings ...)
2017-12-20 12:58 ` [dpdk-dev] [PATCH v2 1/4] net/dpaa: " Shreyansh Jain
@ 2018-01-17 23:00 ` Thomas Monjalon
2018-01-22 2:53 ` [dpdk-dev] 答复: " wang.yong19
4 siblings, 1 reply; 10+ messages in thread
From: Thomas Monjalon @ 2018-01-17 23:00 UTC (permalink / raw)
To: Yong Wang; +Cc: dev, hemant.agrawal, beilei.xing, wenzhuo.lu, john.griffin
Hi,
Please could you rebase on master and keep the acked already given?
Please use --in-reply-to to keep v3 in the same thread as v2.
Titles are the same for every patches.
Are they all fixing a NULL pointer check and a mem leak?
More details in the commit message may help.
If they are fixes, a tag Fixes: may help for backports.
Thanks
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] 答复: Re: [PATCH v2 1/4] net/dpaa: add null point check and fix mem leak
2018-01-17 23:00 ` Thomas Monjalon
@ 2018-01-22 2:53 ` wang.yong19
2018-01-22 7:51 ` Thomas Monjalon
0 siblings, 1 reply; 10+ messages in thread
From: wang.yong19 @ 2018-01-22 2:53 UTC (permalink / raw)
To: thomas; +Cc: dev, hemant.agrawal, beilei.xing, wenzhuo.lu, john.griffin
Hi,
I've sent this patch again and it is accepted.
The other 3 pathes have no conflict with the latest master version and the titles have described the modification of the patches.
So I need not send the patches for v3, right?
------------------origin------------------
From : <thomas@monjalon.net>;
to :wang.yong19@zte.com.cn;
cc: <dev@dpdk.org>; <hemant.agrawal@nxp.com>; <beilei.xing@intel.com>; <wenzhuo.lu@intel.com>; <john.griffin@intel.com>;
date :2018-01-18 07:00
subject :Re: [dpdk-dev] [PATCH v2 1/4] net/dpaa: add null point check and fix mem leak
Hi,
Please could you rebase on master and keep the acked already given?
Please use --in-reply-to to keep v3 in the same thread as v2.
Titles are the same for every patches.
Are they all fixing a NULL pointer check and a mem leak?
More details in the commit message may help.
If they are fixes, a tag Fixes: may help for backports.
Thanks
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] 答复: Re: [PATCH v2 1/4] net/dpaa: add null point check and fix mem leak
2018-01-22 2:53 ` [dpdk-dev] 答复: " wang.yong19
@ 2018-01-22 7:51 ` Thomas Monjalon
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Monjalon @ 2018-01-22 7:51 UTC (permalink / raw)
To: wang.yong19; +Cc: dev, hemant.agrawal, beilei.xing, wenzhuo.lu, john.griffin
Hi,
22/01/2018 03:53, wang.yong19@zte.com.cn:
> Hi,
> I've sent this patch again and it is accepted.
> The other 3 pathes have no conflict with the latest master version and the titles have described the modification of the patches.
> So I need not send the patches for v3, right?
Please re-send those which are not integrated yet,
with more details, and appropriate title.
Thanks
> ------------------origin------------------
> From : <thomas@monjalon.net>;
> to :wang.yong19@zte.com.cn;
> cc: <dev@dpdk.org>; <hemant.agrawal@nxp.com>; <beilei.xing@intel.com>; <wenzhuo.lu@intel.com>; <john.griffin@intel.com>;
> date :2018-01-18 07:00
> subject :Re: [dpdk-dev] [PATCH v2 1/4] net/dpaa: add null point check and fix mem leak
> Hi,
>
> Please could you rebase on master and keep the acked already given?
> Please use --in-reply-to to keep v3 in the same thread as v2.
>
> Titles are the same for every patches.
> Are they all fixing a NULL pointer check and a mem leak?
> More details in the commit message may help.
>
> If they are fixes, a tag Fixes: may help for backports.
>
> Thanks
^ permalink raw reply [flat|nested] 10+ messages in thread