From patchwork Mon Dec 4 14:03:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 120542 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4473644qgn; Mon, 4 Dec 2017 06:04:47 -0800 (PST) X-Google-Smtp-Source: AGs4zMZaZCgxRAO1+wK8jS+cHuHYky8WFuTi1Y4Tp9WftmXx2lyguv1KMt+nZLDPwm1KC1X+bEBo X-Received: by 10.99.56.26 with SMTP id f26mr14065031pga.328.1512396287624; Mon, 04 Dec 2017 06:04:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512396287; cv=none; d=google.com; s=arc-20160816; b=G/F4aXAJfCwr93N+GaY2pHpqojV/3aSlVogmaj4CEGH2nLQbjYMFkZfM8i+ePfmsMU qDuv/6kxXsVoxqmWP0rJRgJJiGvOO+LU7fUbS804A4U8Sq3EyWJQyW3IFSwuhSKj6Fr8 3fRv8wrM7BQgGexz+9UN6EdzM4yBX3pm21GbeieES4mETpDvtW4x3tHy1KpUJMv0MAAz zBRA0OHXY6Jol1WUAvkqvTKSqXHSxpPJm2jkHK/hldrmUxKLGe6YhRRFvNguOlixA2Wx hknM9r+dKUaddwh1ASBIe3zVTUj2UZTCgwSf+y5zVWcSE+nBU2LPDh4WL5qxzGe4b79X 4VVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Ra6rBB7vxGZBSnUQmdGR9FHiTTk16dI2fMJB2o8axq0=; b=HQ+QiI6fdHNfa/gAK95fXdUSe252AM/XSq1Kc8ge7ItTWP+gGZIH1HeTQ2t/BivxT8 MvgqFIoSLtpjh9VwhhsZotfW5mi+BCwCaNO+TzqIeeEADHePFyAGVfxdX2xQbmnifDPs B4nNXPCEgFV4hUZXwY2X+d0mgsmKY8M4xlgvd2XRrX3P3+ILwO24DvDDr5xrd5p33Ej7 B1DISxIArXrr1NoeXamEo7F30PtYLMDufvCSjDOoPD/xLSOyu5n5L+9zp2kGkxQde+s9 GKC8b07yfexfn6s8u8t2kxDpFDIozGGR/mrjIfQRgbLGJNVYqIFpaN/FPblH/oRDhLJ5 oFZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@christofferdall-dk.20150623.gappssmtp.com header.s=20150623 header.b=VWUudRDw; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bc11si9621880plb.422.2017.12.04.06.04.47; Mon, 04 Dec 2017 06:04:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@christofferdall-dk.20150623.gappssmtp.com header.s=20150623 header.b=VWUudRDw; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754482AbdLDOEK (ORCPT + 9 others); Mon, 4 Dec 2017 09:04:10 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:39864 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754288AbdLDOD5 (ORCPT ); Mon, 4 Dec 2017 09:03:57 -0500 Received: by mail-wr0-f195.google.com with SMTP id a41so15543388wra.6 for ; Mon, 04 Dec 2017 06:03:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=christofferdall-dk.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ra6rBB7vxGZBSnUQmdGR9FHiTTk16dI2fMJB2o8axq0=; b=VWUudRDwAYOSHR2E5Q5pWP6oMNhZxjvahu1XUFmnOVlMx9jqxwU35cF9sZUFy4fO3k uXMfLaNmaUElvJf5CvON5dh4lYpUDL9h2zF8ugiTyuWagpVd3XJCafJhTnPOipdIkWpE JiE0afOsCb7HXC4ErjQQfUsVU9d3Zh2Sp0n6NqDTqL5DSEQHSICF4dvZEApgB5uSmO4X 82lTTVb4/Hb0DBL6oAtuuC49DD6Q534AJHpryRViWj3r2ZUbjk8qXn3szF1Y+pEebpET 1gAtgpjRIZ/uFfubVqeSOczRORL1IGUB5V5FtSmDNezpK5KXkdyrsJgg5Jdw8Tyhz7PE Xxng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Ra6rBB7vxGZBSnUQmdGR9FHiTTk16dI2fMJB2o8axq0=; b=S4Eh6bPTnotOO/0b4NKFs3Wy/BgRaHo0QuV17wCjVf/VE8f+peh1BcTDRdQzTXBCdu a0m5pAf/HNt8vCB5tLXEtE7e5Ovw3dbJ/wtKvjNOQbMEpTmRSC6iscdQ8NbdwZiC61Ul Fh96QFD5v2ANtQ2B7mnoszXtgWYF0QSrNWHEmrVbQ5tQV11Y1tkNVliLflAuOzQl2l/W UWjuXuewoU2mIlgOKrA63mfN6PiR2VjVKcYP18g5gNmPCv9SBBCIK2Gzf8EPXryFQ3A9 oiQhyrbUEeZlG5Q26JdCPNKSy7IRp6jcUvIL/qOn0A4SP8AOJruNdK6F1WQucDzTrzKh d9Jw== X-Gm-Message-State: AJaThX6TxT+J/sliMGXO8TuIGA1NS2Bd8pbh6LKqaGizoWxMBdRzBzGl 42+Mshh7muWU2ZMYIoYbCQnaHQ== X-Received: by 10.223.170.150 with SMTP id h22mr13010188wrc.26.1512396235635; Mon, 04 Dec 2017 06:03:55 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id g7sm22794279wra.38.2017.12.04.06.03.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Dec 2017 06:03:54 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= Cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Marc Zyngier , stable@vger.kernel.org, Christoffer Dall Subject: [PULL 06/19] KVM: arm/arm64: vgic-its: Check result of allocation before use Date: Mon, 4 Dec 2017 15:03:35 +0100 Message-Id: <20171204140348.21965-4-cdall@kernel.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171204135637.21620-1-cdall@kernel.org> References: <20171204135637.21620-1-cdall@kernel.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marc Zyngier We miss a test against NULL after allocation. Fixes: 6d03a68f8054 ("KVM: arm64: vgic-its: Turn device_id validation into generic ID validation") Cc: # 4.8 Reported-by: AKASHI Takahiro Acked-by: Christoffer Dall Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic-its.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.14.2 diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c index cb2d0a2dbe5a..8e633bd9cc1e 100644 --- a/virt/kvm/arm/vgic/vgic-its.c +++ b/virt/kvm/arm/vgic/vgic-its.c @@ -821,6 +821,8 @@ static int vgic_its_alloc_collection(struct vgic_its *its, return E_ITS_MAPC_COLLECTION_OOR; collection = kzalloc(sizeof(*collection), GFP_KERNEL); + if (!collection) + return -ENOMEM; collection->collection_id = coll_id; collection->target_addr = COLLECTION_NOT_MAPPED;