]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
crypto: caam - fix invalid dereference in caam_rsa_init_tfm()
authorHoria Geantă <horia.geanta@nxp.com>
Mon, 3 Apr 2017 15:30:07 +0000 (18:30 +0300)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 21 Apr 2017 08:17:00 +0000 (10:17 +0200)
BugLink: http://bugs.launchpad.net/bugs/1685140
commit 33fa46d7b310e06d2cb2ab5417c100af120bfb65 upstream.

In case caam_jr_alloc() fails, ctx->dev carries the error code,
thus accessing it with dev_err() is incorrect.

Fixes: 8c419778ab57e ("crypto: caam - add support for RSA algorithm")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/crypto/caam/caampkc.c

index 32100c4851dd4bd94b9b5b6814558812d8b13629..49cbdcba7883072decb2683857ebb8da856cd68c 100644 (file)
@@ -506,7 +506,7 @@ static int caam_rsa_init_tfm(struct crypto_akcipher *tfm)
        ctx->dev = caam_jr_alloc();
 
        if (IS_ERR(ctx->dev)) {
-               dev_err(ctx->dev, "Job Ring Device allocation for transform failed\n");
+               pr_err("Job Ring Device allocation for transform failed\n");
                return PTR_ERR(ctx->dev);
        }