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: 10090347 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1BD8D60329 for ; Mon, 4 Dec 2017 14:04:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04B602899A for ; Mon, 4 Dec 2017 14:04:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EDC0628D1D; Mon, 4 Dec 2017 14:04:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,URIBL_DBL_ABUSE_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BB172899A for ; Mon, 4 Dec 2017 14:04:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754243AbdLDOET (ORCPT ); Mon, 4 Dec 2017 09:04:19 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:42238 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754178AbdLDOD5 (ORCPT ); Mon, 4 Dec 2017 09:03:57 -0500 Received: by mail-wr0-f193.google.com with SMTP id s66so17395033wrc.9 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=QH3ghe3LLI5tZkmPBfqFo9xndJM/oK61hZOttcAppcaeK/TxenOFjln4K7PIuOFmsU P/QvD2VbyouZfztlEkXtgJ002zloDNIfFoNKnP0rS2/d9fKERf3M1oDTlPFU+9uB3jOu RWK3YtdKHV9cdAJCdfYbyQXzNYkx5V/FD4XFbbsicFV1lSmpxHQTrl1soYSN3y7zuYHb lImGGg6jq1sfi6WyqjQZwpzRrgqPjDQz0yDGny/qB5Pd7DAT8/Mz9F0XN+JKESfyvvEf nzvxHqmu/G3F5iz2AjwPtCmG2J6bKDtEL+YYpFX2hy94tZce7y+GtsiQeGqf2APj1p9S DJXg== X-Gm-Message-State: AJaThX7IFlz3KIJdTMEhyv2nrtLdIsJi31VIPG/vHLGYcVOtQ3PSRF3w CQQAyozjWzYXGZ4XIUMyEFYUBXhC/RU= X-Google-Smtp-Source: AGs4zMZTytOj1zF/pkhPmVRPo0P6Rddk7xNNVelFCGQhuUI5HLJrE0vZdO1fJNNL2pIL5MvbhK88tA== 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?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= 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: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(+) 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;