From f5915326b2262cf057b6bb240e7b8cd899e95afc Mon Sep 17 00:00:00 2001 From: Jaren Johnston Date: Fri, 15 Jun 2012 08:37:22 +0200 Subject: [PATCH] null ptr check & resource release fix Signed-off-by: Nikos Mavrogiannopoulos --- authenc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/authenc.c b/authenc.c index ddfaaee..698febd 100644 --- a/authenc.c +++ b/authenc.c @@ -633,7 +633,7 @@ __crypto_auth_run_zc(struct csession *ses_ptr, struct kernel_crypt_auth_op *kcao return -ENOMEM; } - if (caop->auth_len > 0) { + if (caop->auth_src && caop->auth_len > 0) { if (unlikely(copy_from_user(auth_buf, caop->auth_src, caop->auth_len))) { dprintk(1, KERN_ERR, "unable to copy auth data from userspace.\n"); ret = -EFAULT; @@ -663,7 +663,8 @@ __crypto_auth_run_zc(struct csession *ses_ptr, struct kernel_crypt_auth_op *kcao ses_ptr->cdata.aead == 0)) { dprintk(0, KERN_ERR, "Only stream and AEAD ciphers are allowed for authenc\n"); - return -EINVAL; + ret = -EINVAL; + goto fail; } if (caop->op == COP_ENCRYPT) dst_len = caop->len + cryptodev_cipher_get_tag_size(&ses_ptr->cdata); -- 2.11.4.GIT