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: 10090363 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 BCE1760329 for ; Mon, 4 Dec 2017 14:05:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4BC82842B for ; Mon, 4 Dec 2017 14:05:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 932F62842D; Mon, 4 Dec 2017 14:05:10 +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=-2.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED, URIBL_DBL_ABUSE_SPAM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 224472842B for ; Mon, 4 Dec 2017 14:05:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=JwcC1ixtzjw1Vnm/atVRtsHNZRX+i2jUle43ViCeFjM=; b=Lg1FHMJwEq2JewRfK4pZ+gtLpo 4e7Xfc7E6wDsQL+2Fx+KdFBTSv1hZu90WeZH9nes5wk7IjtkwuDkqKUzGsvn1L/dAfvOXsecb8j58 LVd7QuE8/APS+T+iDJ69QBIZR7ZCy7wzeZMY9M8IC+SOOjCT9HnCZSBP1EyyEjqx1ShhCtEwkPMIY eHYhiM2C0hum/LYi98bkuMYt6+RJUZz9R2zFzkWoX0UqvxXd3lsvS5bdnDOww9auQr3fzzD+hlAsR pWKvwffFXkqZYjwSsqenxNgbn0LpmGSzYDBxZfq/v6ghyK0oEc6SUGA1HquFpvRBCymU8MZ2AK/lh TxMgk1Gw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eLrMr-0003ae-5B; Mon, 04 Dec 2017 14:05:09 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eLrM1-0002O1-Iu for linux-arm-kernel@lists.infradead.org; Mon, 04 Dec 2017 14:04:21 +0000 Received: by mail-wr0-x243.google.com with SMTP id y21so17359964wrc.1 for ; Mon, 04 Dec 2017 06:03:57 -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=c6aBJHtD9brJY8n3ncME7Pjy85HL4F9RqufxtOSWnNtEObo4EPlX6c/WMzgiCcec05 7vTnkImREy7gMSbi6dLBSbo6hZFDZY7HdjXOCHg5fGjnvhKt6UQKJzZ8skQbN8VI07BU 0j19nQxNdGW8RMAbwr7fZI00E02HU+IkDxT9hOiA9H8/8Hftn1VMcAb1mRm0S7ssFzcU Qf9leryKPxKsJTzb2lnndcfDepptzCdAs41RkULhHhFptAv8pMGOmnJURTQBH5CTKIWG IyB7TgiUuqsES+ckSpD2x5FnZ4iCHCtO/4wPG4zF1gBq5b9NuoCY3CwNsI8ug4v7Oo3S KtBQ== X-Gm-Message-State: AJaThX7CeKtWPvuQvn/GScGCsQY7Iu+QMRhjz1Hi/fa2QlWqi+a1oQSF mXOMHEXtYL4IUJUEIBInvAv4/Q== 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?= 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171204_060417_858571_6E622963 X-CRM114-Status: UNSURE ( 8.91 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , stable@vger.kernel.org, Christoffer Dall , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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;