lkml.org 
[lkml]   [2016]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.6 017/100] crypto: caam - fix caam_jr_alloc() ret code
    Date
    4.6-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Catalin Vasile <cata.vasile@nxp.com>

    commit e930c765ca5c6b039cd22ebfb4504ea7b5dab43d upstream.

    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.

    Signed-off-by: Catalin Vasile <cata.vasile@nxp.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/crypto/caam/jr.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/drivers/crypto/caam/jr.c
    +++ b/drivers/crypto/caam/jr.c
    @@ -248,7 +248,7 @@ static void caam_jr_dequeue(unsigned lon
    struct device *caam_jr_alloc(void)
    {
    struct caam_drv_private_jr *jrpriv, *min_jrpriv = NULL;
    - struct device *dev = NULL;
    + struct device *dev = ERR_PTR(-ENODEV);
    int min_tfm_cnt = INT_MAX;
    int tfm_cnt;


    \
     
     \ /
      Last update: 2016-05-31 00:01    [W:4.293 / U:0.068 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site