Blame SOURCES/CVE-2021-3715.patch

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