Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2319385pxu; Sun, 13 Dec 2020 22:09:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxkm9lQW/tLvRNUebO/SJzJn3fY+oqrkFtr4UGTXImHAaen6/MxBthlYOm5VDgDV3GP0Bgn X-Received: by 2002:a05:6402:17:: with SMTP id d23mr13672558edu.341.1607926142273; Sun, 13 Dec 2020 22:09:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607926142; cv=none; d=google.com; s=arc-20160816; b=ILyPZ2vMATDbbVep04iYozi0TjyRttq1wrH7QNjZf34gOE41r7GJvt4PDlkqFdosFM /8P/GEJtoFXP39qTGomi9+o7CMkw8gFHA9uer2YnANHCIgOIXtsXPIZJ0iLbEX2TpOyA qWZgAyQSQrkt0MJNQ4NU1LtU/3HbYqayl/pSanDofcFS+i/OWqwx12t9K1eSz95D5TFk DRzmOLhC6qlL+n+3lbzZUshITlhZ9CFZOBD6BZlgTk6uxSWJ6yCifXrtjcAVtS9G/elb 9mMs8xrHqrI+OlNIlpmEr2BBfczPrsmse+pOvGE6rIQmkbfe56R8wOFa1jYdO/TqerwQ s0Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kn3KZ7/GxYn1wDyYk6D1LQUiV8vDzkIoMPBbbiV7RLY=; b=iaL1lT/bc8zlKidP/4+Kw1OA4mds7off+/J5kVtBOW5HKiYxYZnNrYRuwlziSzTBSl sLdWkizAaMXodnb8PrdPmQWIltWju4l3oVKI2Miw7RTsYps0DM1NjNvOloDXbWoEXyNx 5CWKYKQ5+2By/nl+TPEY31gFd4HPedKxFeLe0S0qkTMVKHDkmSnMQCU/4MDevYJnI7FH K9cNHM+wJD0qvHrnBTzR0tZBS7wDVElEC6CNR47fYxiy4UCSynnOpvphExK800gPwAGl I7IALMTprrKSOmluKhDdUQ+24E7Y5GAfZGk28jV/OkS9yKRnLKMVeeJ4F0+APa9I2XGJ +zUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="eGxraiV/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f13si9566742edw.454.2020.12.13.22.08.39; Sun, 13 Dec 2020 22:09:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="eGxraiV/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407787AbgLLS6A (ORCPT + 99 others); Sat, 12 Dec 2020 13:58:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25663 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407742AbgLLSwC (ORCPT ); Sat, 12 Dec 2020 13:52:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607799035; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kn3KZ7/GxYn1wDyYk6D1LQUiV8vDzkIoMPBbbiV7RLY=; b=eGxraiV/1KUR8nDsy3NkSoZiERVW4pvi7rlk2Pfc6gPLtyFqfOtPA3lWGZzpAhLJcotG5d oGHm3aKyoZq9ghLmV36j7fpraI8nz2VaJnB+niwrHn358MIy818VP3dm2F4nft2F3RLzS7 Dr4rWzyM2o2/Z4AJ0KFDRZUR7/qmgXA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-153-jrQyYtE6O0GLo8dAS1Pvuw-1; Sat, 12 Dec 2020 13:50:34 -0500 X-MC-Unique: jrQyYtE6O0GLo8dAS1Pvuw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 63E5C800D55; Sat, 12 Dec 2020 18:50:32 +0000 (UTC) Received: from laptop.redhat.com (ovpn-115-41.ams2.redhat.com [10.36.115.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 892131F069; Sat, 12 Dec 2020 18:50:29 +0000 (UTC) From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, maz@kernel.org, drjones@redhat.com Cc: alexandru.elisei@arm.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, shuah@kernel.org, pbonzini@redhat.com Subject: [PATCH 2/9] KVM: arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION read Date: Sat, 12 Dec 2020 19:50:03 +0100 Message-Id: <20201212185010.26579-3-eric.auger@redhat.com> In-Reply-To: <20201212185010.26579-1-eric.auger@redhat.com> References: <20201212185010.26579-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The doc says: "The characteristics of a specific redistributor region can be read by presetting the index field in the attr data. Only valid for KVM_DEV_TYPE_ARM_VGIC_V3" Unfortunately the existing code fails to read the input attr data and thus the index always is 0. Fixes: 04c110932225 ("KVM: arm/arm64: Implement KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION") Cc: stable@vger.kernel.org#v4.17+ Signed-off-by: Eric Auger --- arch/arm64/kvm/vgic/vgic-kvm-device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/kvm/vgic/vgic-kvm-device.c b/arch/arm64/kvm/vgic/vgic-kvm-device.c index 44419679f91a..2f66cf247282 100644 --- a/arch/arm64/kvm/vgic/vgic-kvm-device.c +++ b/arch/arm64/kvm/vgic/vgic-kvm-device.c @@ -226,6 +226,9 @@ static int vgic_get_common_attr(struct kvm_device *dev, u64 addr; unsigned long type = (unsigned long)attr->attr; + if (copy_from_user(&addr, uaddr, sizeof(addr))) + return -EFAULT; + r = kvm_vgic_addr(dev->kvm, type, &addr, false); if (r) return (r == -ENODEV) ? -ENXIO : r; -- 2.21.3