Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Giovanni Cabiddu and committed by
Herbert Xu
378bc4ed a826806b

+4 -4
+4 -4
drivers/crypto/qat/qat_common/qat_uclo.c
··· 967 967 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; 968 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 970 obj_handle->encap_uof_obj.beg_uof = obj_handle->obj_hdr->file_buff; 975 971 obj_handle->encap_uof_obj.obj_hdr = (struct icp_qat_uof_objhdr *) 976 972 obj_handle->obj_hdr->file_buff; ··· 978 982 pr_err("QAT: UOF incompatible\n"); 979 983 return -EINVAL; 980 984 } 985 + obj_handle->uword_buf = kcalloc(UWORD_CPYBUF_SIZE, sizeof(uint64_t), 986 + GFP_KERNEL); 987 + if (!obj_handle->uword_buf) 988 + return -ENOMEM; 981 989 obj_handle->ustore_phy_size = ICP_QAT_UCLO_MAX_USTORE; 982 990 if (!obj_handle->obj_hdr->file_buff || 983 991 !qat_uclo_map_str_table(obj_handle->obj_hdr, ICP_QAT_UOF_STRT,