Commit 9fefc78
net/sched: sch_cake: Fix incorrect qlen reduction in cake_drop
In cake_drop(), qdisc_tree_reduce_backlog() is used to update the qlen
and backlog of the qdisc hierarchy. Its caller, cake_enqueue(), assumes
that the parent qdisc will enqueue the current packet. However, this
assumption breaks when cake_enqueue() returns NET_XMIT_CN: the parent
qdisc stops enqueuing current packet, leaving the tree qlen/backlog
accounting inconsistent. This mismatch can lead to a NULL dereference
(e.g., when the parent Qdisc is qfq_qdisc).
This patch computes the qlen/backlog delta in a more robust way by
observing the difference before and after the series of cake_drop()
calls, and then compensates the qdisc tree accounting if cake_enqueue()
returns NET_XMIT_CN.
To ensure correct compensation when ACK thinning is enabled, a new
variable is introduced to keep qlen unchanged.
Fixes: 15de71d ("net/sched: Make cake_enqueue return NET_XMIT_CN when past buffer_limit")
Signed-off-by: Xiang Mei <[email protected]>
Reviewed-by: Toke Høiland-Jørgensen <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>1 parent e5235eb commit 9fefc78
1 file changed
+32
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1597 | 1597 | | |
1598 | 1598 | | |
1599 | 1599 | | |
1600 | | - | |
1601 | 1600 | | |
1602 | 1601 | | |
1603 | 1602 | | |
| |||
1743 | 1742 | | |
1744 | 1743 | | |
1745 | 1744 | | |
| 1745 | + | |
1746 | 1746 | | |
1747 | | - | |
1748 | | - | |
| 1747 | + | |
1749 | 1748 | | |
1750 | 1749 | | |
1751 | 1750 | | |
1752 | 1751 | | |
1753 | | - | |
| 1752 | + | |
1754 | 1753 | | |
1755 | 1754 | | |
1756 | 1755 | | |
| |||
1823 | 1822 | | |
1824 | 1823 | | |
1825 | 1824 | | |
| 1825 | + | |
| 1826 | + | |
1826 | 1827 | | |
1827 | 1828 | | |
1828 | 1829 | | |
| |||
1833 | 1834 | | |
1834 | 1835 | | |
1835 | 1836 | | |
1836 | | - | |
1837 | | - | |
| 1837 | + | |
| 1838 | + | |
1838 | 1839 | | |
1839 | 1840 | | |
1840 | 1841 | | |
1841 | 1842 | | |
1842 | | - | |
| 1843 | + | |
1843 | 1844 | | |
1844 | 1845 | | |
1845 | 1846 | | |
| |||
1848 | 1849 | | |
1849 | 1850 | | |
1850 | 1851 | | |
1851 | | - | |
1852 | | - | |
1853 | | - | |
1854 | | - | |
1855 | | - | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
1856 | 1857 | | |
1857 | 1858 | | |
1858 | 1859 | | |
| |||
1927 | 1928 | | |
1928 | 1929 | | |
1929 | 1930 | | |
1930 | | - | |
1931 | | - | |
1932 | | - | |
1933 | | - | |
| 1931 | + | |
| 1932 | + | |
1934 | 1933 | | |
1935 | | - | |
1936 | | - | |
1937 | | - | |
| 1934 | + | |
| 1935 | + | |
1938 | 1936 | | |
1939 | | - | |
1940 | | - | |
1941 | | - | |
1942 | | - | |
1943 | | - | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
1944 | 1947 | | |
1945 | | - | |
1946 | | - | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
1947 | 1952 | | |
| 1953 | + | |
1948 | 1954 | | |
1949 | 1955 | | |
1950 | 1956 | | |
| |||
0 commit comments