Commit abd672d
packet: fix races in fanout_add()
[ Upstream commit d199fab63c11998a602205f7ee7ff7c05c97164b ]
Multiple threads can call fanout_add() at the same time.
We need to grab fanout_mutex earlier to avoid races that could
lead to one thread freeing po->rollover that was set by another thread.
Do the same in fanout_release(), for peace of mind, and to help us
finding lockdep issues earlier.
Fixes: dc99f60 ("packet: Add fanout support.")
Fixes: 0648ab7 ("packet: rollover prepare: per-socket state")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 2b3eb43 commit abd672d
1 file changed
Lines changed: 30 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1623 | 1623 | | |
1624 | 1624 | | |
1625 | 1625 | | |
| 1626 | + | |
1626 | 1627 | | |
1627 | 1628 | | |
1628 | 1629 | | |
| |||
1645 | 1646 | | |
1646 | 1647 | | |
1647 | 1648 | | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
1648 | 1652 | | |
1649 | | - | |
| 1653 | + | |
1650 | 1654 | | |
| 1655 | + | |
1651 | 1656 | | |
1652 | | - | |
| 1657 | + | |
1653 | 1658 | | |
1654 | 1659 | | |
1655 | 1660 | | |
1656 | | - | |
1657 | | - | |
1658 | | - | |
1659 | | - | |
1660 | | - | |
1661 | | - | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
1662 | 1669 | | |
1663 | 1670 | | |
1664 | | - | |
1665 | 1671 | | |
1666 | 1672 | | |
1667 | 1673 | | |
| |||
1708 | 1714 | | |
1709 | 1715 | | |
1710 | 1716 | | |
1711 | | - | |
1712 | | - | |
1713 | | - | |
| 1717 | + | |
| 1718 | + | |
1714 | 1719 | | |
1715 | 1720 | | |
| 1721 | + | |
1716 | 1722 | | |
1717 | 1723 | | |
1718 | 1724 | | |
| |||
1721 | 1727 | | |
1722 | 1728 | | |
1723 | 1729 | | |
1724 | | - | |
1725 | | - | |
1726 | | - | |
1727 | | - | |
1728 | 1730 | | |
1729 | | - | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
1730 | 1741 | | |
1731 | | - | |
1732 | | - | |
1733 | | - | |
1734 | | - | |
1735 | | - | |
| 1742 | + | |
| 1743 | + | |
1736 | 1744 | | |
1737 | 1745 | | |
1738 | | - | |
1739 | | - | |
1740 | | - | |
1741 | 1746 | | |
1742 | 1747 | | |
1743 | 1748 | | |
| |||
0 commit comments