Commit 6b5c13b
s390/ism: Fix locking for forwarding of IRQs and events to clients
The clients array references all registered clients and is protected by
the clients_lock. Besides its use as general list of clients the clients
array is accessed in ism_handle_irq() to forward ISM device events to
clients.
While the clients_lock is taken in the IRQ handler when calling
handle_event() it is however incorrectly not held during the
client->handle_irq() call and for the preceding clients[] access leaving
it unprotected against concurrent client (un-)registration.
Furthermore the accesses to ism->sba_client_arr[] in ism_register_dmb()
and ism_unregister_dmb() are not protected by any lock. This is
especially problematic as the client ID from the ism->sba_client_arr[]
is not checked against NO_CLIENT and neither is the client pointer
checked.
Instead of expanding the use of the clients_lock further add a separate
array in struct ism_dev which references clients subscribed to the
device's events and IRQs. This array is protected by ism->lock which is
already taken in ism_handle_irq() and can be taken outside the IRQ
handler when adding/removing subscribers or the accessing
ism->sba_client_arr[]. This also means that the clients_lock is no
longer taken in IRQ context.
Fixes: 89e7d2b ("net/ism: Add new API for client registration")
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>1 parent c329b26 commit 6b5c13b
2 files changed
Lines changed: 37 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
50 | 59 | | |
51 | 60 | | |
52 | 61 | | |
| |||
71 | 80 | | |
72 | 81 | | |
73 | 82 | | |
| 83 | + | |
74 | 84 | | |
75 | 85 | | |
76 | 86 | | |
| |||
92 | 102 | | |
93 | 103 | | |
94 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
95 | 108 | | |
96 | 109 | | |
97 | 110 | | |
| |||
101 | 114 | | |
102 | 115 | | |
103 | 116 | | |
| 117 | + | |
104 | 118 | | |
105 | 119 | | |
106 | 120 | | |
| |||
328 | 342 | | |
329 | 343 | | |
330 | 344 | | |
| 345 | + | |
331 | 346 | | |
332 | 347 | | |
333 | 348 | | |
| |||
351 | 366 | | |
352 | 367 | | |
353 | 368 | | |
| 369 | + | |
354 | 370 | | |
| 371 | + | |
355 | 372 | | |
356 | 373 | | |
357 | 374 | | |
| |||
360 | 377 | | |
361 | 378 | | |
362 | 379 | | |
| 380 | + | |
363 | 381 | | |
364 | 382 | | |
365 | 383 | | |
| |||
368 | 386 | | |
369 | 387 | | |
370 | 388 | | |
| 389 | + | |
371 | 390 | | |
| 391 | + | |
372 | 392 | | |
373 | 393 | | |
374 | 394 | | |
| |||
491 | 511 | | |
492 | 512 | | |
493 | 513 | | |
| 514 | + | |
494 | 515 | | |
495 | 516 | | |
496 | 517 | | |
| |||
499 | 520 | | |
500 | 521 | | |
501 | 522 | | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
507 | 528 | | |
508 | 529 | | |
509 | 530 | | |
510 | 531 | | |
511 | 532 | | |
512 | 533 | | |
513 | | - | |
514 | 534 | | |
515 | 535 | | |
516 | 536 | | |
| 537 | + | |
517 | 538 | | |
518 | 539 | | |
519 | 540 | | |
| |||
530 | 551 | | |
531 | 552 | | |
532 | 553 | | |
533 | | - | |
534 | | - | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
535 | 558 | | |
536 | 559 | | |
537 | 560 | | |
| |||
554 | 577 | | |
555 | 578 | | |
556 | 579 | | |
| 580 | + | |
557 | 581 | | |
558 | 582 | | |
559 | 583 | | |
| |||
691 | 715 | | |
692 | 716 | | |
693 | 717 | | |
| 718 | + | |
694 | 719 | | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
695 | 723 | | |
696 | 724 | | |
697 | 725 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
0 commit comments