crypto: marvell/octeontx - Fix a potential NULL dereference
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 5 Jun 2020 11:03:39 +0000 (14:03 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 15 Jun 2020 07:38:54 +0000 (17:38 +1000)
commit1f5b07f5dd1748a6f9363fb1a76d599c74af8231
treef8e323054ce83d071e26fd4192280a38fb0eb43a
parent77251e41f89a813b4090f5199442f217bbf11297
crypto: marvell/octeontx - Fix a potential NULL dereference

Smatch reports that:

    drivers/crypto/marvell/octeontx/otx_cptvf_algs.c:132 otx_cpt_aead_callback()
    warn: variable dereferenced before check 'cpt_info' (see line 121)

This function is called from process_pending_queue() as:

drivers/crypto/marvell/octeontx/otx_cptvf_reqmgr.c
   599                  /*
   600                   * Call callback after current pending entry has been
   601                   * processed, we don't do it if the callback pointer is
   602                   * invalid.
   603                   */
   604                  if (callback)
   605                          callback(res_code, areq, cpt_info);

It does appear to me that "cpt_info" can be NULL so this could lead to
a NULL dereference.

Fixes: 10b4f09491bf ("crypto: marvell - add the Virtual Function driver for CPT")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/marvell/octeontx/otx_cptvf_algs.c