Commit 8d909b2
printk: syslog: close window between wait and read
Syslog's SYSLOG_ACTION_READ is supposed to block until the next
syslog record can be read, and then it should read that record.
However, because @syslog_lock is not held between waking up and
reading the record, another reader could read the record first,
thus causing SYSLOG_ACTION_READ to return with a value of 0, never
having read _anything_.
By holding @syslog_lock between waking up and reading, it can be
guaranteed that SYSLOG_ACTION_READ blocks until it successfully
reads a syslog record (or a real error occurs).
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20210715193359.25946-7-john.ogness@linutronix.de1 parent b371cbb commit 8d909b2
1 file changed
Lines changed: 36 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1480 | 1480 | | |
1481 | 1481 | | |
1482 | 1482 | | |
| 1483 | + | |
1483 | 1484 | | |
1484 | 1485 | | |
1485 | 1486 | | |
1486 | 1487 | | |
1487 | 1488 | | |
1488 | 1489 | | |
| 1490 | + | |
1489 | 1491 | | |
1490 | 1492 | | |
1491 | 1493 | | |
1492 | 1494 | | |
1493 | 1495 | | |
1494 | 1496 | | |
1495 | 1497 | | |
1496 | | - | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
1497 | 1520 | | |
1498 | 1521 | | |
| 1522 | + | |
1499 | 1523 | | |
1500 | | - | |
1501 | | - | |
1502 | | - | |
| 1524 | + | |
1503 | 1525 | | |
1504 | | - | |
| 1526 | + | |
1505 | 1527 | | |
1506 | 1528 | | |
1507 | 1529 | | |
| |||
1528 | 1550 | | |
1529 | 1551 | | |
1530 | 1552 | | |
1531 | | - | |
1532 | 1553 | | |
1533 | 1554 | | |
1534 | 1555 | | |
1535 | 1556 | | |
1536 | | - | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
1537 | 1562 | | |
1538 | 1563 | | |
1539 | 1564 | | |
| |||
1542 | 1567 | | |
1543 | 1568 | | |
1544 | 1569 | | |
1545 | | - | |
1546 | | - | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
1547 | 1573 | | |
1548 | 1574 | | |
1549 | 1575 | | |
| |||
1614 | 1640 | | |
1615 | 1641 | | |
1616 | 1642 | | |
1617 | | - | |
1618 | 1643 | | |
1619 | 1644 | | |
1620 | 1645 | | |
| |||
1632 | 1657 | | |
1633 | 1658 | | |
1634 | 1659 | | |
1635 | | - | |
1636 | | - | |
1637 | | - | |
1638 | | - | |
1639 | | - | |
1640 | | - | |
1641 | | - | |
1642 | | - | |
1643 | | - | |
1644 | 1660 | | |
1645 | 1661 | | |
1646 | 1662 | | |
| |||
1707 | 1723 | | |
1708 | 1724 | | |
1709 | 1725 | | |
| 1726 | + | |
1710 | 1727 | | |
1711 | 1728 | | |
1712 | 1729 | | |
| |||
0 commit comments