thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/0021-Using-ip_deq-after-m_free-might-read-pointers-from-a.patch

ddf19c
From ab9ebc29bb9bb142e73a160750a451d40bfe9746 Mon Sep 17 00:00:00 2001
ddf19c
From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@redhat.com>
ddf19c
Date: Mon, 16 Sep 2019 17:07:00 +0100
ddf19c
Subject: Using ip_deq after m_free might read pointers from an allocation
ddf19c
 reuse.
ddf19c
MIME-Version: 1.0
ddf19c
Content-Type: text/plain; charset=UTF-8
ddf19c
Content-Transfer-Encoding: 8bit
ddf19c
ddf19c
RH-Author: Philippe Mathieu-Daudé <philmd@redhat.com>
ddf19c
Message-id: <20190916170700.647-2-philmd@redhat.com>
ddf19c
Patchwork-id: 90470
ddf19c
O-Subject: [RHEL-AV-8.1.0 qemu-kvm PATCH 1/1] Using ip_deq after m_free might read pointers from an allocation reuse.
ddf19c
Bugzilla: 1749737
ddf19c
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
ddf19c
RH-Acked-by: John Snow <jsnow@redhat.com>
ddf19c
ddf19c
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
ddf19c
ddf19c
This would be difficult to exploit, but that is still related with
ddf19c
CVE-2019-14378 which generates fragmented IP packets that would trigger this
ddf19c
issue and at least produce a DoS.
ddf19c
ddf19c
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
ddf19c
(cherry picked from libslirp commit c59279437eda91841b9d26079c70b8a540d41204)
ddf19c
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
ddf19c
ddf19c
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ddf19c
---
ddf19c
 slirp/src/ip_input.c | 7 +++++--
ddf19c
 1 file changed, 5 insertions(+), 2 deletions(-)
ddf19c
ddf19c
diff --git a/slirp/src/ip_input.c b/slirp/src/ip_input.c
ddf19c
index 8c75d91495..df1c846ade 100644
ddf19c
--- a/slirp/src/ip_input.c
ddf19c
+++ b/slirp/src/ip_input.c
ddf19c
@@ -292,6 +292,7 @@ static struct ip *ip_reass(Slirp *slirp, struct ip *ip, struct ipq *fp)
ddf19c
      */
ddf19c
     while (q != (struct ipasfrag *)&fp->frag_link &&
ddf19c
            ip->ip_off + ip->ip_len > q->ipf_off) {
ddf19c
+        struct ipasfrag *prev;
ddf19c
         i = (ip->ip_off + ip->ip_len) - q->ipf_off;
ddf19c
         if (i < q->ipf_len) {
ddf19c
             q->ipf_len -= i;
ddf19c
@@ -299,9 +300,11 @@ static struct ip *ip_reass(Slirp *slirp, struct ip *ip, struct ipq *fp)
ddf19c
             m_adj(dtom(slirp, q), i);
ddf19c
             break;
ddf19c
         }
ddf19c
+        prev = q;
ddf19c
         q = q->ipf_next;
ddf19c
-        m_free(dtom(slirp, q->ipf_prev));
ddf19c
-        ip_deq(q->ipf_prev);
ddf19c
+        ip_deq(prev);
ddf19c
+        m_free(dtom(slirp, prev));
ddf19c
+
ddf19c
     }
ddf19c
 
ddf19c
 insert:
ddf19c
-- 
ddf19c
2.21.0
ddf19c