Commit c0dccad
hvc/xen: lock console list traversal
The currently lockless access to the xen console list in
vtermno_to_xencons() is incorrect, as additions and removals from the
list can happen anytime, and as such the traversal of the list to get
the private console data for a given termno needs to happen with the
lock held. Note users that modify the list already do so with the
lock taken.
Adjust current lock takers to use the _irq{save,restore} helpers,
since the context in which vtermno_to_xencons() is called can have
interrupts disabled. Use the _irq{save,restore} set of helpers to
switch the current callers to disable interrupts in the locked region.
I haven't checked if existing users could instead use the _irq
variant, as I think it's safer to use _irq{save,restore} upfront.
While there switch from using list_for_each_entry_safe to
list_for_each_entry: the current entry cursor won't be removed as
part of the code in the loop body, so using the _safe variant is
pointless.
Fixes: 02e19f9 ('hvc_xen: implement multiconsole support')
Signed-off-by: Roger Pau Monné <[email protected]>
Reviewed-by: Stefano Stabellini <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Juergen Gross <[email protected]>1 parent 37c1785 commit c0dccad
1 file changed
+29
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
| 56 | + | |
56 | 57 | | |
57 | | - | |
58 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
59 | 63 | | |
60 | | - | |
| 64 | + | |
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
65 | 69 | | |
| 70 | + | |
66 | 71 | | |
67 | 72 | | |
68 | 73 | | |
| |||
223 | 228 | | |
224 | 229 | | |
225 | 230 | | |
226 | | - | |
| 231 | + | |
227 | 232 | | |
228 | 233 | | |
229 | 234 | | |
| |||
258 | 263 | | |
259 | 264 | | |
260 | 265 | | |
261 | | - | |
| 266 | + | |
262 | 267 | | |
263 | | - | |
| 268 | + | |
264 | 269 | | |
265 | 270 | | |
266 | 271 | | |
| |||
283 | 288 | | |
284 | 289 | | |
285 | 290 | | |
| 291 | + | |
286 | 292 | | |
287 | 293 | | |
288 | 294 | | |
| |||
299 | 305 | | |
300 | 306 | | |
301 | 307 | | |
302 | | - | |
| 308 | + | |
303 | 309 | | |
304 | | - | |
| 310 | + | |
305 | 311 | | |
306 | 312 | | |
307 | 313 | | |
308 | 314 | | |
309 | 315 | | |
310 | 316 | | |
311 | 317 | | |
| 318 | + | |
312 | 319 | | |
313 | 320 | | |
314 | 321 | | |
| |||
323 | 330 | | |
324 | 331 | | |
325 | 332 | | |
326 | | - | |
| 333 | + | |
327 | 334 | | |
328 | | - | |
| 335 | + | |
329 | 336 | | |
330 | 337 | | |
331 | 338 | | |
| |||
380 | 387 | | |
381 | 388 | | |
382 | 389 | | |
| 390 | + | |
| 391 | + | |
383 | 392 | | |
384 | | - | |
| 393 | + | |
385 | 394 | | |
386 | | - | |
| 395 | + | |
387 | 396 | | |
388 | 397 | | |
389 | 398 | | |
| |||
464 | 473 | | |
465 | 474 | | |
466 | 475 | | |
| 476 | + | |
467 | 477 | | |
468 | 478 | | |
469 | 479 | | |
| |||
482 | 492 | | |
483 | 493 | | |
484 | 494 | | |
485 | | - | |
| 495 | + | |
486 | 496 | | |
487 | | - | |
| 497 | + | |
488 | 498 | | |
489 | 499 | | |
490 | 500 | | |
| |||
584 | 594 | | |
585 | 595 | | |
586 | 596 | | |
| 597 | + | |
| 598 | + | |
587 | 599 | | |
588 | | - | |
| 600 | + | |
589 | 601 | | |
590 | | - | |
| 602 | + | |
591 | 603 | | |
592 | 604 | | |
593 | 605 | | |
| |||
0 commit comments