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