]> www.infradead.org Git - users/jedix/linux-maple.git/commit
crypto: caam - fix caam_jr_alloc() ret code
authorCatalin Vasile <cata.vasile@nxp.com>
Fri, 6 May 2016 13:18:53 +0000 (16:18 +0300)
committerDhaval Giani <dhaval.giani@oracle.com>
Fri, 20 Jan 2017 22:21:54 +0000 (17:21 -0500)
commita757b5df76f22ff8442cf94a23ee794d17239abb
tree492192a91b10a8ccce6934f0fc7331bbc9ff8ce6
parent1af3b6028b6c207d3309228127a9c33f58e55a7e
crypto: caam - fix caam_jr_alloc() ret code

Orabug: 25256932

[ Upstream commit e930c765ca5c6b039cd22ebfb4504ea7b5dab43d ]

caam_jr_alloc() used to return NULL if a JR device could not be
allocated for a session. In turn, every user of this function used
IS_ERR() function to verify if anything went wrong, which does NOT look
for NULL values. This made the kernel crash if the sanity check failed,
because the driver continued to think it had allocated a valid JR dev
instance to the session and at some point it tries to do a caam_jr_free()
on a NULL JR dev pointer.
This patch is a fix for this issue.

Cc: <stable@vger.kernel.org>
Signed-off-by: Catalin Vasile <cata.vasile@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
(cherry picked from commit ceee7b2f9dbb0c8ac05b00f2095662587c98f861)
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
drivers/crypto/caam/jr.c