[PATCH] net_sched: cls_route: remove from list when handle is 0
authorThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Tue, 2 Aug 2022 08:52:56 +0000 (05:52 -0300)
committerSalvatore Bonaccorso <carnil@debian.org>
Wed, 10 Aug 2022 18:11:48 +0000 (19:11 +0100)
commitfaf03b789e63d97c3c1efbfb6945699a098ce5e9
tree08f000526eade7ee6f9bee845187251969694876
parent20b27e149656e64aa8cc4b543dabec48872231de
[PATCH] net_sched: cls_route: remove from list when handle is 0

When a route filter is replaced and the old filter has a 0 handle, the old
one won't be removed from the hashtable, while it will still be freed.

The test was there since before commit 1109c00547fc ("net: sched: RCU
cls_route"), when a new filter was not allocated when there was an old one.
The old filter was reused and the reinserting would only be necessary if an
old filter was replaced. That was still wrong for the same case where the
old handle was 0.

Remove the old filter from the list independently from its handle value.

This fixes CVE-2022-2588, also reported as ZDI-CAN-17440.

Reported-by: Zhenpeng Lin <zplin@u.northwestern.edu>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Reviewed-by: Kamal Mostafa <kamal@canonical.com>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name net_sched-cls_route-remove-from-list-when-handle-is-.patch
net/sched/cls_route.c