cryptodev: fix uninitialized session clear
authorMarko Kovacevic <marko.kovacevic@intel.com>
Mon, 15 Apr 2019 15:04:49 +0000 (16:04 +0100)
committerAkhil Goyal <akhil.goyal@nxp.com>
Thu, 18 Apr 2019 14:01:28 +0000 (16:01 +0200)
added check to see if a session for a device
has been initialised if it has return 0.

Fixes: 5d6c73dd5938 ("cryptodev: add reference count to session private data")
Cc: stable@dpdk.org
Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
lib/librte_cryptodev/rte_cryptodev.c

index 2675e1e..00c2cf4 100644 (file)
@@ -1386,6 +1386,8 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
                return -EINVAL;
 
        driver_id = dev->driver_id;
+       if (sess->sess_data[driver_id].refcnt == 0)
+               return 0;
        if (--sess->sess_data[driver_id].refcnt != 0)
                return -EBUSY;