diff options
| author | Giovanni Cabiddu <giovanni.cabiddu@intel.com> | 2016-09-06 06:18:51 -0400 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-09-13 08:27:22 -0400 |
| commit | 378bc4ed74a6c30c25012935c7af175501dda374 (patch) | |
| tree | b9e3815bd4362905a7601a1dfad8f20c8a56eb6f /drivers/crypto | |
| parent | a826806b7c598f65a7b1322235ab049b1cbd8b16 (diff) | |
crypto: qat - fix leak on error path
Fix a memory leak in an error path in uc loader.
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
| -rw-r--r-- | drivers/crypto/qat/qat_common/qat_uclo.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/crypto/qat/qat_common/qat_uclo.c b/drivers/crypto/qat/qat_common/qat_uclo.c index 9b961b37a282..e2454d90d949 100644 --- a/drivers/crypto/qat/qat_common/qat_uclo.c +++ b/drivers/crypto/qat/qat_common/qat_uclo.c | |||
| @@ -967,10 +967,6 @@ static int qat_uclo_parse_uof_obj(struct icp_qat_fw_loader_handle *handle) | |||
| 967 | struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; | 967 | struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; |
| 968 | unsigned int ae; | 968 | unsigned int ae; |
| 969 | 969 | ||
| 970 | obj_handle->uword_buf = kcalloc(UWORD_CPYBUF_SIZE, sizeof(uint64_t), | ||
| 971 | GFP_KERNEL); | ||
| 972 | if (!obj_handle->uword_buf) | ||
| 973 | return -ENOMEM; | ||
| 974 | obj_handle->encap_uof_obj.beg_uof = obj_handle->obj_hdr->file_buff; | 970 | obj_handle->encap_uof_obj.beg_uof = obj_handle->obj_hdr->file_buff; |
| 975 | obj_handle->encap_uof_obj.obj_hdr = (struct icp_qat_uof_objhdr *) | 971 | obj_handle->encap_uof_obj.obj_hdr = (struct icp_qat_uof_objhdr *) |
| 976 | obj_handle->obj_hdr->file_buff; | 972 | obj_handle->obj_hdr->file_buff; |
| @@ -982,6 +978,10 @@ static int qat_uclo_parse_uof_obj(struct icp_qat_fw_loader_handle *handle) | |||
| 982 | pr_err("QAT: UOF incompatible\n"); | 978 | pr_err("QAT: UOF incompatible\n"); |
| 983 | return -EINVAL; | 979 | return -EINVAL; |
| 984 | } | 980 | } |
| 981 | obj_handle->uword_buf = kcalloc(UWORD_CPYBUF_SIZE, sizeof(uint64_t), | ||
| 982 | GFP_KERNEL); | ||
| 983 | if (!obj_handle->uword_buf) | ||
| 984 | return -ENOMEM; | ||
| 985 | obj_handle->ustore_phy_size = ICP_QAT_UCLO_MAX_USTORE; | 985 | obj_handle->ustore_phy_size = ICP_QAT_UCLO_MAX_USTORE; |
| 986 | if (!obj_handle->obj_hdr->file_buff || | 986 | if (!obj_handle->obj_hdr->file_buff || |
| 987 | !qat_uclo_map_str_table(obj_handle->obj_hdr, ICP_QAT_UOF_STRT, | 987 | !qat_uclo_map_str_table(obj_handle->obj_hdr, ICP_QAT_UOF_STRT, |
