Blame SOURCES/CVE-2021-3715.patch

4747aa
From: Artem Savkov <asavkov@redhat.com>
4747aa
Subject: [RHEL-7.9 CVE-2021-3715 KPATCH] net_sched: cls_route: remove the right filter from hashtable
4747aa
Date: Mon, 30 Aug 2021 17:33:51 +0200
4747aa
4747aa
Kernels:
4747aa
3.10.0-1160.el7
4747aa
3.10.0-1160.2.1.el7
4747aa
3.10.0-1160.2.2.el7
4747aa
3.10.0-1160.6.1.el7
4747aa
3.10.0-1160.11.1.el7
4747aa
3.10.0-1160.15.2.el7
4747aa
3.10.0-1160.21.1.el7
4747aa
3.10.0-1160.24.1.el7
4747aa
3.10.0-1160.25.1.el7
4747aa
3.10.0-1160.31.1.el7
4747aa
3.10.0-1160.36.2.el7
4747aa
3.10.0-1160.41.1.el7
4747aa
4747aa
Changes since last build:
4747aa
arches: x86_64 ppc64le
4747aa
cls_route.o: changed function: route4_change
4747aa
---------------------------
4747aa
4747aa
Kernels:
4747aa
3.10.0-1160.el7
4747aa
3.10.0-1160.2.1.el7
4747aa
3.10.0-1160.2.2.el7
4747aa
3.10.0-1160.6.1.el7
4747aa
3.10.0-1160.11.1.el7
4747aa
3.10.0-1160.15.2.el7
4747aa
3.10.0-1160.21.1.el7
4747aa
3.10.0-1160.24.1.el7
4747aa
3.10.0-1160.25.1.el7
4747aa
3.10.0-1160.31.1.el7
4747aa
3.10.0-1160.36.2.el7
4747aa
4747aa
Modifications: none
4747aa
Z-MR: https://gitlab.com/redhat/rhel/src/kernel/rhel-7/-/merge_requests/251
4747aa
4747aa
commit f4e1814eb56167451ddd819fccb951178f97660b
4747aa
Author: Ivan Vecera <ivecera@redhat.com>
4747aa
Date:   Tue Aug 17 12:21:33 2021 +0200
4747aa
4747aa
    net_sched: cls_route: remove the right filter from hashtable
4747aa
4747aa
    Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1992926
4747aa
4747aa
    commit ef299cc3fa1a9e1288665a9fdc8bff55629fd359
4747aa
    Author: Cong Wang <xiyou.wangcong@gmail.com>
4747aa
    Date:   Fri Mar 13 22:29:54 2020 -0700
4747aa
4747aa
        net_sched: cls_route: remove the right filter from hashtable
4747aa
4747aa
        route4_change() allocates a new filter and copies values from
4747aa
        the old one. After the new filter is inserted into the hash
4747aa
        table, the old filter should be removed and freed, as the final
4747aa
        step of the update.
4747aa
4747aa
        However, the current code mistakenly removes the new one. This
4747aa
        looks apparently wrong to me, and it causes double "free" and
4747aa
        use-after-free too, as reported by syzbot.
4747aa
4747aa
        Reported-and-tested-by: syzbot+f9b32aaacd60305d9687@syzkaller.appspotmail.com
4747aa
        Reported-and-tested-by: syzbot+2f8c233f131943d6056d@syzkaller.appspotmail.com
4747aa
        Reported-and-tested-by: syzbot+9c2df9fd5e9445b74e01@syzkaller.appspotmail.com
4747aa
        Fixes: 1109c00547fc ("net: sched: RCU cls_route")
4747aa
        Cc: Jamal Hadi Salim <jhs@mojatatu.com>
4747aa
        Cc: Jiri Pirko <jiri@resnulli.us>
4747aa
        Cc: John Fastabend <john.fastabend@gmail.com>
4747aa
        Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
4747aa
        Signed-off-by: David S. Miller <davem@davemloft.net>
4747aa
4747aa
    Signed-off-by: Ivan Vecera <ivecera@redhat.com>
4747aa
4747aa
Signed-off-by: Artem Savkov <asavkov@redhat.com>
4747aa
Acked-by: Joe Lawrence <joe.lawrence@redhat.com>
4747aa
---
4747aa
 net/sched/cls_route.c | 4 ++--
4747aa
 1 file changed, 2 insertions(+), 2 deletions(-)
4747aa
4747aa
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
4747aa
index 7bd464e8d084..2fed29fa504e 100644
4747aa
--- a/net/sched/cls_route.c
4747aa
+++ b/net/sched/cls_route.c
4747aa
@@ -534,8 +534,8 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,
4747aa
 			fp = &b->ht[h];
4747aa
 			for (pfp = rtnl_dereference(*fp); pfp;
4747aa
 			     fp = &pfp->next, pfp = rtnl_dereference(*fp)) {
4747aa
-				if (pfp == f) {
4747aa
-					*fp = f->next;
4747aa
+				if (pfp == fold) {
4747aa
+					rcu_assign_pointer(*fp, fold->next);
4747aa
 					break;
4747aa
 				}
4747aa
 			}
4747aa
-- 
4747aa
2.31.1
4747aa
4747aa