Skip to content

Commit 2dd6486

Browse files
kv2019ifabiobaltieri
authored andcommitted
soc/intel_adsp: ipc: initialize semaphore in driver init
The ipc driver device data (struct intel_adsp_ipc_data) contains a semaphore. Upon device init, the device data is zeroed out. This is safe for other fields, but the semaphore should be properly initialized before use. This lack of initialization leads to a system crash when CONFIG_POLL is enabled (e.g. to enable CONFIG_SHELL), IPC driver handles an interrupt and executes k_sem_give() on a uninitialized semaphore object. This will eventually lead to null dereference in z_handle_obj_poll_events(). Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent 571ad19 commit 2dd6486

File tree

1 file changed

+2
-0
lines changed
  • soc/intel/intel_adsp/common

1 file changed

+2
-0
lines changed

soc/intel/intel_adsp/common/ipc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ int intel_adsp_ipc_init(const struct device *dev)
100100

101101
memset(devdata, 0, sizeof(*devdata));
102102

103+
k_sem_init(&devdata->sem, 0, 1);
104+
103105
/* ACK any latched interrupts (including TDA to clear IDA on
104106
* the other side!), then enable.
105107
*/

0 commit comments

Comments
 (0)