Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1442583pxf; Fri, 12 Mar 2021 09:34:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJzizjcHDAhC+BlLR1iAz4SRSbhmR486tHZ1N4JILdbSNWvwFuxCVVUcE6pw66RIyiQfFl7E X-Received: by 2002:aa7:c4d1:: with SMTP id p17mr15601701edr.387.1615570439884; Fri, 12 Mar 2021 09:33:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615570439; cv=none; d=google.com; s=arc-20160816; b=cM27/5Kkwm5WdqKoNAi1HarXAKhjgpLTHeUSaq7AkzWzwDBRyjlRMp6JgRFKUkrC6m N6E+ac7AgaM2J//WPZoi1TCG0Yr/I8QxumLZ6CCdVuAN+0cPMxT2OKWD/XyBHnv+US1Z bWEEC09XhIafSCOyJf711IyNX/3xs7YO9Ze5up+bv51R55ZOYPAluKzZaZZ0ATmRdZ4y pYf5sCcz/soGjJy3hoVRE+bRoePRBmx0eFXS/6VpVmZLHyITaw2kUam9vJLmv7b6o1ob 1qr4zqcgoqVQgr2ehlX4J/ZsWs4oUjJtCK0rk5UJWgbBHjcm1pBEdv5XWeHh+JJ9pTLY MnAg== 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=mdDREx6XEJ8GpRKupc63kfJAVUqoQp9Cy3QT3dCgXGE=; b=t8ev7MecOf1e6+mhrX4lWmK5meXH+YfOTCoMmhKzjDJyKm4sheBFnDorEulWuae5eJ xMA5K2zSwyBhhkHC3lcjLfiQeJegWg5sPv4gFNiYtijtmX1KecNtDZq4Sim4p1cy3KbA jrduL94VItsuw9E38g8YLazdDOAtoDT8ulYp2+D9TtE7ImvLUvHvcUINMF4p/2LQR67Z XyrzGPNPtHrJ74P70nii39rmbiPyvn0FVSj3If5hpt3NhF9SRLu0kuFKFm64CxjWqnQC OMqw+OrZC4cF9BK8aeSjofsox2PPUf4x6lA1tfHE6x0XTn8CVxz534RKP54D73h+jXNH HR+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=e0Q3vz2X; 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 o13si4414573eje.367.2021.03.12.09.33.36; Fri, 12 Mar 2021 09:33:59 -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=e0Q3vz2X; 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 S232707AbhCLRci (ORCPT + 99 others); Fri, 12 Mar 2021 12:32:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26291 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231907AbhCLRcZ (ORCPT ); Fri, 12 Mar 2021 12:32:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615570344; 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=mdDREx6XEJ8GpRKupc63kfJAVUqoQp9Cy3QT3dCgXGE=; b=e0Q3vz2XoqvmBPP0h3O/4b4xCi4fNm5fmpo21CJBk6566ytMuAZvjnrTvDcYIBhHnvgMZa VVRExvrvScZCuUqEa4PompPdYpJzEeOIvIuTYcFuDPR+VJf7TaMqA+pR3jdac4qbRSVCea 5STmHk01VrSi/iJQ9S6xYA8uwlcdhPQ= 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-130-Hym53le9OI2ark4-F_kjvg-1; Fri, 12 Mar 2021 12:32:23 -0500 X-MC-Unique: Hym53le9OI2ark4-F_kjvg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 89277800D55; Fri, 12 Mar 2021 17:32:21 +0000 (UTC) Received: from laptop.redhat.com (ovpn-112-254.ams2.redhat.com [10.36.112.254]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52A971002388; Fri, 12 Mar 2021 17:32:17 +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, alexandru.elisei@arm.com Cc: james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, shuah@kernel.org, pbonzini@redhat.com Subject: [PATCH v3 2/8] KVM: arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION read Date: Fri, 12 Mar 2021 18:31:56 +0100 Message-Id: <20210312173202.89576-3-eric.auger@redhat.com> In-Reply-To: <20210312173202.89576-1-eric.auger@redhat.com> References: <20210312173202.89576-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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. 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 Reviewed-by: Alexandru Elisei --- v1 -> v2: - in the commit message, remove the statement that the index always is 0 - add Alexandru's R-b --- 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.26.2