cryptodev: fix freeing after device release
authorCiara Power <ciara.power@intel.com>
Wed, 21 Jul 2021 12:51:22 +0000 (12:51 +0000)
committerAkhil Goyal <gakhil@marvell.com>
Fri, 30 Jul 2021 19:08:12 +0000 (21:08 +0200)
commiteeaeca82b8cbd6599bafd4029aad5ce4dedff7a2
tree07217a58726db23a27ecb57137ec34a0339b7cf5
parent0f678fdd8c909e126406bd1ba386e9da8937027f
cryptodev: fix freeing after device release

The PMD destroy function was calling the release function, which frees
cryptodev->data, and then tries to free cryptodev->data->dev_private,
which causes the heap use after free issue.

A temporary pointer is set before the free of cryptodev->data,
which can then be used afterwards to free dev_private.
The free cannot be moved to before the release function is called,
as dev_private is used in the PMD close function while being released.

Fixes: 9e6edea41805 ("cryptodev: add APIs to assist PMD initialisation")
Cc: stable@dpdk.org
Reported-by: Zhihong Peng <zhihongx.peng@intel.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
lib/cryptodev/rte_cryptodev_pmd.c