yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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