mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
firmware: stratix10-svc: fixes for v7.2
- Fix a memory leak by explicitly using kfree() to match the list-managed lifetime - Fix FCS SMC call documentation - Add proper handling of a no response from the SDM - Fix teardown order of service driver -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoHhMeiyk5VmwVMwNGZQEC4GjKPQFAmpWtbsACgkQGZQEC4Gj KPQK1w/5AQ/6CZdKEdxd/PiajG8vdp0LaBoDoQxbOlRbj+W9BBrAGHM1Ehv1zhQv oK7ZGMqIjgvcnFPe2oqqwp4RO9T50vf+HrrY7cxWMkyb7uxSWftLR87o1m46Nm7c 7kL9P5oSXybSLSuoQz5/KdeFcmlTrBi+fqAfCLb0UhLMOTBLo4nkmfQCr9mYAE2E KHkJWRigjH9I/netKfe9HJUIZaD7f4kG12uqo7BJK+KuA2rzJiGjlZGXIwTJh4xL obMfGSLwhSNQovxIqGvbD5tKqNxJ1luhrPPfTQkanna9keoLwUndAm4l6bX0rrTT Uz9E+G8rJ/TWeHqjTplJ4+QphdCnXz4XQvq8X8LFPnqPhL+LKysmLHzoO2sLBF+F pwD9qv4sl334kn0u+jnfjY1ry2PaidwcVubG7He4uW7le95lFap2tvyDY1yhRGxH 76uq3jm+bb5lZE4xyhvJzWU1P0e5oBPaQSglh+xukM2ghAVRgHV59HNMTJOUldKG LlXh/5k76ETBXcIH0QyBZ0jMEpzZH8HnH3/j3CQ0OTTeH59f93h5obU2GWt7Tkac ZzAtbtmbi7GLwl517g8AuWHV97fLYE26C4Nqlz1sUbRiWSHcEIV6RbP1vRwsGfZT bCiZUHEzOUFwP595U3lbEJ6lqCGqS0Zo0WYuoxa84f3Np5m4Ajo= =Yzbe -----END PGP SIGNATURE----- Merge tag 'svc_fixes_for_v7.2' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux into char-misc-linus Dinh writes: firmware: stratix10-svc: fixes for v7.2 - Fix a memory leak by explicitly using kfree() to match the list-managed lifetime - Fix FCS SMC call documentation - Add proper handling of a no response from the SDM - Fix teardown order of service driver * tag 'svc_fixes_for_v7.2' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux: firmware: stratix10-svc: fix teardown order in remove to prevent race firmware: stratix10-svc: handle NO_RESPONSE in async poll firmware: stratix10-svc: fix FCS SMC call kernel-doc firmware: stratix10-svc: fix memory leaks and list corruption bugs
This commit is contained in:
commit
48ca706b8f
|
|
@ -1499,8 +1499,9 @@ int stratix10_svc_async_poll(struct stratix10_svc_chan *chan,
|
|||
WARN_ON_ONCE(1);
|
||||
}
|
||||
return 0;
|
||||
} else if (handle->res.a0 == INTEL_SIP_SMC_STATUS_BUSY) {
|
||||
dev_dbg(ctrl->dev, "async message is still in progress\n");
|
||||
} else if (handle->res.a0 == INTEL_SIP_SMC_STATUS_BUSY ||
|
||||
handle->res.a0 == INTEL_SIP_SMC_STATUS_NO_RESPONSE) {
|
||||
dev_dbg(ctrl->dev, "async message is not ready yet\n");
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
|
|
@ -1857,14 +1858,16 @@ void *stratix10_svc_allocate_memory(struct stratix10_svc_chan *chan,
|
|||
struct gen_pool *genpool = chan->ctrl->genpool;
|
||||
size_t s = roundup(size, 1 << genpool->min_alloc_order);
|
||||
|
||||
pmem = devm_kzalloc(chan->ctrl->dev, sizeof(*pmem), GFP_KERNEL);
|
||||
pmem = kzalloc_obj(*pmem);
|
||||
if (!pmem)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
guard(mutex)(&svc_mem_lock);
|
||||
va = gen_pool_alloc(genpool, s);
|
||||
if (!va)
|
||||
if (!va) {
|
||||
kfree(pmem);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
memset((void *)va, 0, s);
|
||||
pa = gen_pool_virt_to_phys(genpool, va);
|
||||
|
|
@ -1890,6 +1893,7 @@ EXPORT_SYMBOL_GPL(stratix10_svc_allocate_memory);
|
|||
void stratix10_svc_free_memory(struct stratix10_svc_chan *chan, void *kaddr)
|
||||
{
|
||||
struct stratix10_svc_data_mem *pmem;
|
||||
|
||||
guard(mutex)(&svc_mem_lock);
|
||||
|
||||
list_for_each_entry(pmem, &svc_data_mem, node)
|
||||
|
|
@ -1898,10 +1902,9 @@ void stratix10_svc_free_memory(struct stratix10_svc_chan *chan, void *kaddr)
|
|||
(unsigned long)kaddr, pmem->size);
|
||||
pmem->vaddr = NULL;
|
||||
list_del(&pmem->node);
|
||||
kfree(pmem);
|
||||
return;
|
||||
}
|
||||
|
||||
list_del(&svc_data_mem);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(stratix10_svc_free_memory);
|
||||
|
||||
|
|
@ -2046,12 +2049,12 @@ static void stratix10_svc_drv_remove(struct platform_device *pdev)
|
|||
struct stratix10_svc_controller *ctrl = platform_get_drvdata(pdev);
|
||||
struct stratix10_svc *svc = ctrl->svc;
|
||||
|
||||
platform_device_unregister(svc->stratix10_svc_rsu);
|
||||
|
||||
stratix10_svc_async_exit(ctrl);
|
||||
|
||||
of_platform_depopulate(ctrl->dev);
|
||||
|
||||
platform_device_unregister(svc->stratix10_svc_rsu);
|
||||
|
||||
for (i = 0; i < SVC_NUM_CHANNEL; i++) {
|
||||
if (ctrl->chans[i].task) {
|
||||
kthread_stop(ctrl->chans[i].task);
|
||||
|
|
|
|||
|
|
@ -67,6 +67,9 @@
|
|||
* INTEL_SIP_SMC_STATUS_REJECTED:
|
||||
* Secure monitor software reject the service client's request.
|
||||
*
|
||||
* INTEL_SIP_SMC_STATUS_NO_RESPONSE:
|
||||
* Secure monitor software has no response for the request yet.
|
||||
*
|
||||
* INTEL_SIP_SMC_STATUS_ERROR:
|
||||
* There is error during the process of service request.
|
||||
*
|
||||
|
|
@ -77,6 +80,7 @@
|
|||
#define INTEL_SIP_SMC_STATUS_OK 0x0
|
||||
#define INTEL_SIP_SMC_STATUS_BUSY 0x1
|
||||
#define INTEL_SIP_SMC_STATUS_REJECTED 0x2
|
||||
#define INTEL_SIP_SMC_STATUS_NO_RESPONSE 0x3
|
||||
#define INTEL_SIP_SMC_STATUS_ERROR 0x4
|
||||
#define INTEL_SIP_SMC_RSU_ERROR 0x7
|
||||
|
||||
|
|
@ -606,7 +610,7 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)
|
|||
|
||||
/**
|
||||
* Request INTEL_SIP_SMC_FUNCID_FCS_SEND_CERTIFICATE
|
||||
* Sync call to send a signed certificate
|
||||
* Async call to send a signed certificate
|
||||
*
|
||||
* Call register usage:
|
||||
* a0 INTEL_SIP_SMC_FCS_SEND_CERTIFICATE
|
||||
|
|
@ -615,7 +619,7 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)
|
|||
* a3-a7 not used
|
||||
*
|
||||
* Return status:
|
||||
* a0 INTEL_SIP_SMC_STATUS_OK or INTEL_SIP_SMC_FCS_REJECTED
|
||||
* a0 INTEL_SIP_SMC_STATUS_OK or INTEL_SIP_SMC_REJECTED
|
||||
* a1-a3 not used
|
||||
*/
|
||||
#define INTEL_SIP_SMC_FUNCID_FCS_SEND_CERTIFICATE 93
|
||||
|
|
@ -631,9 +635,11 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)
|
|||
* a1-a7 not used
|
||||
*
|
||||
* Return status:
|
||||
* a0 INTEL_SIP_SMC_STATUS_OK, INTEL_SIP_SMC_FCS_ERROR or
|
||||
* INTEL_SIP_SMC_FCS_REJECTED
|
||||
* a1-a3 not used
|
||||
* a0 INTEL_SIP_SMC_STATUS_OK, INTEL_SIP_SMC_STATUS_ERROR or
|
||||
* INTEL_SIP_SMC_STATUS_REJECTED
|
||||
* a1 mailbox error if a0 is INTEL_SIP_SMC_STATUS_ERROR
|
||||
* a2 physical address for the structure of fuse and key hashes
|
||||
* a3 the size of structure
|
||||
*
|
||||
*/
|
||||
#define INTEL_SIP_SMC_FUNCID_FCS_GET_PROVISION_DATA 94
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user