In opae_adapter_destroy(), pointer "adapter" is not validated before
passing it to opae_adapter_shm_free() and opae_adapter_mutex_close()
which dereference it.
Coverity issue: 363752
Fixes:
e41856b515ce ("raw/ifpga/base: enhance driver reliability in multi-process")
Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
*/
void opae_adapter_destroy(struct opae_adapter *adapter)
{
- if (adapter && adapter->ops && adapter->ops->destroy)
- adapter->ops->destroy(adapter);
- opae_adapter_shm_free(adapter);
- opae_adapter_mutex_close(adapter);
+ if (adapter) {
+ if (adapter->ops && adapter->ops->destroy)
+ adapter->ops->destroy(adapter);
+ opae_adapter_shm_free(adapter);
+ opae_adapter_mutex_close(adapter);
+ }
}
/**