Commit 38290b1
Sudeep Holla
firmware: arm_ffa: Snapshot notifier callbacks under lock
Both notification handlers currently look up a notifier callback under
notify_lock, drop the lock, and then dereference the returned
notifier entry. A concurrent unregister can delete and free that
entry in the gap, leaving the handler to dereference stale memory.
Copy the callback pointer and callback data while notify_lock is
still held and invoke the callback only after the lock is dropped.
This keeps the existing callback execution model while removing the
use-after-free window in both the framework and non-framework
notification paths.
Fixes: 285a5ea ("firmware: arm_ffa: Add support for handling framework notifications")
Link: https://patch.msgid.link/20260428-ffa_fixes-v2-10-8595ae450034@kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>1 parent 0399e3f commit 38290b1
1 file changed
Lines changed: 23 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1463 | 1463 | | |
1464 | 1464 | | |
1465 | 1465 | | |
| 1466 | + | |
| 1467 | + | |
1466 | 1468 | | |
1467 | | - | |
1468 | 1469 | | |
1469 | 1470 | | |
1470 | 1471 | | |
1471 | 1472 | | |
1472 | 1473 | | |
1473 | 1474 | | |
1474 | | - | |
1475 | | - | |
1476 | | - | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
1477 | 1482 | | |
1478 | | - | |
1479 | | - | |
| 1483 | + | |
| 1484 | + | |
1480 | 1485 | | |
1481 | 1486 | | |
1482 | 1487 | | |
1483 | 1488 | | |
1484 | 1489 | | |
1485 | 1490 | | |
1486 | 1491 | | |
| 1492 | + | |
1487 | 1493 | | |
| 1494 | + | |
1488 | 1495 | | |
1489 | | - | |
1490 | 1496 | | |
1491 | 1497 | | |
1492 | 1498 | | |
| |||
1522 | 1528 | | |
1523 | 1529 | | |
1524 | 1530 | | |
1525 | | - | |
1526 | | - | |
1527 | | - | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
1528 | 1539 | | |
1529 | | - | |
1530 | | - | |
| 1540 | + | |
| 1541 | + | |
1531 | 1542 | | |
1532 | 1543 | | |
1533 | 1544 | | |
| |||
0 commit comments