Commit b66accaa authored by Tong Zhang's avatar Tong Zhang Committed by Herbert Xu

crypto: qat - don't release uninitialized resources

adf_vf_isr_resource_alloc() is not unwinding correctly when error
happens and it want to release uninitialized resources.
To fix this, only release initialized resources.

[    1.792845] Trying to free already-free IRQ 11
[    1.793091] WARNING: CPU: 0 PID: 182 at kernel/irq/manage.c:1821 free_irq+0x202/0x380
[    1.801340] Call Trace:
[    1.801477]  adf_vf_isr_resource_free+0x32/0xb0 [intel_qat]
[    1.801785]  adf_vf_isr_resource_alloc+0x14d/0x150 [intel_qat]
[    1.802105]  adf_dev_init+0xba/0x140 [intel_qat]
Signed-off-by: default avatarTong Zhang <ztong0001@gmail.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Fixes: dd0f3683 ("crypto: qat - Add qat dh895xcc VF driver")
Acked-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 5b0ef799
...@@ -261,17 +261,26 @@ int adf_vf_isr_resource_alloc(struct adf_accel_dev *accel_dev) ...@@ -261,17 +261,26 @@ int adf_vf_isr_resource_alloc(struct adf_accel_dev *accel_dev)
goto err_out; goto err_out;
if (adf_setup_pf2vf_bh(accel_dev)) if (adf_setup_pf2vf_bh(accel_dev))
goto err_out; goto err_disable_msi;
if (adf_setup_bh(accel_dev)) if (adf_setup_bh(accel_dev))
goto err_out; goto err_cleanup_pf2vf_bh;
if (adf_request_msi_irq(accel_dev)) if (adf_request_msi_irq(accel_dev))
goto err_out; goto err_cleanup_bh;
return 0; return 0;
err_cleanup_bh:
adf_cleanup_bh(accel_dev);
err_cleanup_pf2vf_bh:
adf_cleanup_pf2vf_bh(accel_dev);
err_disable_msi:
adf_disable_msi(accel_dev);
err_out: err_out:
adf_vf_isr_resource_free(accel_dev);
return -EFAULT; return -EFAULT;
} }
EXPORT_SYMBOL_GPL(adf_vf_isr_resource_alloc); EXPORT_SYMBOL_GPL(adf_vf_isr_resource_alloc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment