diff mbox

cifs: free blkcipher in smbhash

Message ID 1308594796-29004-1-git-send-email-jlayton@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Layton June 20, 2011, 6:33 p.m. UTC
This is currently leaked in the rc == 0 case.

Reported-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/cifs/smbencrypt.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

Comments

Shirish Pargaonkar June 20, 2011, 7 p.m. UTC | #1
On Mon, Jun 20, 2011 at 1:33 PM, Jeff Layton <jlayton@redhat.com> wrote:
> This is currently leaked in the rc == 0 case.
>
> Reported-by: J. Bruce Fields <bfields@fieldses.org>
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
>  fs/cifs/smbencrypt.c |    6 ++----
>  1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c
> index 1525d5e..1c5b770 100644
> --- a/fs/cifs/smbencrypt.c
> +++ b/fs/cifs/smbencrypt.c
> @@ -90,12 +90,10 @@ smbhash(unsigned char *out, const unsigned char *in, unsigned char *key)
>        sg_init_one(&sgout, out, 8);
>
>        rc = crypto_blkcipher_encrypt(&desc, &sgout, &sgin, 8);
> -       if (rc) {
> +       if (rc)
>                cERROR(1, "could not encrypt crypt key rc: %d\n", rc);
> -               crypto_free_blkcipher(tfm_des);
> -               goto smbhash_err;
> -       }
>
> +       crypto_free_blkcipher(tfm_des);
>  smbhash_err:
>        return rc;
>  }
> --
> 1.7.5.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

Correct.
Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c
index 1525d5e..1c5b770 100644
--- a/fs/cifs/smbencrypt.c
+++ b/fs/cifs/smbencrypt.c
@@ -90,12 +90,10 @@  smbhash(unsigned char *out, const unsigned char *in, unsigned char *key)
 	sg_init_one(&sgout, out, 8);
 
 	rc = crypto_blkcipher_encrypt(&desc, &sgout, &sgin, 8);
-	if (rc) {
+	if (rc)
 		cERROR(1, "could not encrypt crypt key rc: %d\n", rc);
-		crypto_free_blkcipher(tfm_des);
-		goto smbhash_err;
-	}
 
+	crypto_free_blkcipher(tfm_des);
 smbhash_err:
 	return rc;
 }