Commit d9aaf8e
committed
idc: fix a race
Under Zephyr SOF IDC uses Zephyr's P4WQ for message passing. In it
k_p4wq_submit() checks that the new work item isn't already on the
queue, and it does that by checking its .thread member. That pointer
is set to NULL in p4wq_loop() after calling the work handler with no
locks held. So, the work handler could've completed handling an IPC,
a response could have been sent and a new IPC could arrive, while
p4wq_loop() still hasn't cleared the .thread pointer. To fix this
use a mutex in idc_send_msg() to protect the work items.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>1 parent 1f18231 commit d9aaf8e
1 file changed
Lines changed: 17 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
119 | 122 | | |
120 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
121 | 126 | | |
122 | 127 | | |
123 | 128 | | |
124 | 129 | | |
125 | 130 | | |
126 | 131 | | |
127 | | - | |
| 132 | + | |
128 | 133 | | |
129 | 134 | | |
130 | 135 | | |
131 | 136 | | |
132 | 137 | | |
133 | 138 | | |
134 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
135 | 147 | | |
136 | 148 | | |
137 | 149 | | |
| |||
158 | 170 | | |
159 | 171 | | |
160 | 172 | | |
| 173 | + | |
| 174 | + | |
161 | 175 | | |
162 | 176 | | |
163 | 177 | | |
| |||
0 commit comments