thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

c461a1
From 90b1929638fb5fed4e5fc65f95b7a76e339e0640 Mon Sep 17 00:00:00 2001
c461a1
From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@redhat.com>
c461a1
Date: Mon, 9 Sep 2019 09:13:33 +0200
c461a1
Subject: [PATCH 01/12] Using ip_deq after m_free might read pointers from an
c461a1
 allocation reuse.
c461a1
MIME-Version: 1.0
c461a1
Content-Type: text/plain; charset=UTF-8
c461a1
Content-Transfer-Encoding: 8bit
c461a1
c461a1
RH-Author: Philippe Mathieu-Daudé <philmd@redhat.com>
c461a1
Message-id: <20190909091333.18511-2-philmd@redhat.com>
c461a1
Patchwork-id: 90336
c461a1
O-Subject: [RHEL-7.8 qemu-kvm PATCH 1/1] Using ip_deq after m_free might read pointers from an allocation reuse.
c461a1
Bugzilla: 1749735
c461a1
RH-Acked-by: John Snow <jsnow@redhat.com>
c461a1
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
c461a1
RH-Acked-by: Thomas Huth <thuth@redhat.com>
c461a1
c461a1
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
c461a1
c461a1
This would be difficult to exploit, but that is still related with
c461a1
CVE-2019-14378 which generates fragmented IP packets that would trigger this
c461a1
issue and at least produce a DoS.
c461a1
c461a1
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
c461a1
(cherry picked from libslirp commit c59279437eda91841b9d26079c70b8a540d41204)
c461a1
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
c461a1
c461a1
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
c461a1
---
c461a1
 slirp/ip_input.c | 6 ++++--
c461a1
 1 file changed, 4 insertions(+), 2 deletions(-)
c461a1
c461a1
diff --git a/slirp/ip_input.c b/slirp/ip_input.c
c461a1
index 5226224..9e95b40 100644
c461a1
--- a/slirp/ip_input.c
c461a1
+++ b/slirp/ip_input.c
c461a1
@@ -296,6 +296,7 @@ ip_reass(Slirp *slirp, struct ip *ip, struct ipq *fp)
c461a1
 	 */
c461a1
 	while (q != (struct ipasfrag*)&fp->frag_link &&
c461a1
             ip->ip_off + ip->ip_len > q->ipf_off) {
c461a1
+		struct ipasfrag *prev;
c461a1
 		i = (ip->ip_off + ip->ip_len) - q->ipf_off;
c461a1
 		if (i < q->ipf_len) {
c461a1
 			q->ipf_len -= i;
c461a1
@@ -303,9 +304,10 @@ ip_reass(Slirp *slirp, struct ip *ip, struct ipq *fp)
c461a1
 			m_adj(dtom(slirp, q), i);
c461a1
 			break;
c461a1
 		}
c461a1
+		prev = q;
c461a1
 		q = q->ipf_next;
c461a1
-		m_free(dtom(slirp, q->ipf_prev));
c461a1
-		ip_deq(q->ipf_prev);
c461a1
+		ip_deq(prev);
c461a1
+		m_free(dtom(slirp, prev));
c461a1
 	}
c461a1
 
c461a1
 insert:
c461a1
-- 
c461a1
1.8.3.1
c461a1