Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp164255pxb; Thu, 14 Jan 2021 02:44:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbYIg9tzeX+Gr5TmB9aDQhaN0fHzafyqJtItC+ZPoNt3SI0XUbH7jEP3vWy6ESFOTcI6cc X-Received: by 2002:aa7:d407:: with SMTP id z7mr5596651edq.234.1610621049853; Thu, 14 Jan 2021 02:44:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610621049; cv=none; d=google.com; s=arc-20160816; b=WinJvjRRqwGeVZe9urOVs47gtbPesy/ozNv2P+BAUWMTmgVV1e5DDDczc5tH7BsJwi RKjs25BhUoNQehG5nU1uSmyRX5lTyMifdiHkHh/4wzw+bb1ta1SCfXAv4wYecEqS+0Pw Pq022lW311Bp/siSWI9PioNUkw0+wmWEmSfrEfnlsNQFGioiger0RctzBGdjt8r2eIYY fMnnjO/znjkQZ+aqH++6PdDnF/wXG/X0V3sHzc+SuSl//tybOri8ghIEXzrRjeqCJgY4 QIdYMXuejrei3PLIvzWx54j3r/ws4qrpDJ/cQgjr92Q8cHv8etGo7U6yZNUuUlPCnR6W PvGg== 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=95+F2jl/Upj/3EJjAAlKRb+ANuvJLslj7pJVhoc87fk=; b=KM4ny95HAP1UDN7I2QX37DVaXlF03gcuoy/O+ltOcLmP9SmE1+hk1jwNdIQp44yMdc Pz4MBTwLef8TB4KkWMSMhq5D5Iy6AeDgN2tfKeOygOI5lCQHDMQ3tfjtIHdh6kJUGDV6 GUbkt60ynhEq05WDg1/AXH70ubbKjnWzkpMMiFoKrLwzAx1BhC7K7tvdxCMo49Ypw9+U DWDqpnMxRdQhzYH5htMNeSs3C0oIrua4fosYoNpsPT2t2GssG/PJlZYjwXlFf1zkNYlj PtTl55WD1B6436JOhd0ozk72Tdl0jP+yRjFhEk9sxR52uByuTRF9pM6nYr5u3tRiS7Wh CqTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="d/hdnhGs"; 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 l14si2495559edb.407.2021.01.14.02.43.44; Thu, 14 Jan 2021 02:44:09 -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="d/hdnhGs"; 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 S1728584AbhANKiw (ORCPT + 99 others); Thu, 14 Jan 2021 05:38:52 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:56008 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728410AbhANKiv (ORCPT ); Thu, 14 Jan 2021 05:38:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610620646; 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=95+F2jl/Upj/3EJjAAlKRb+ANuvJLslj7pJVhoc87fk=; b=d/hdnhGsQ40uZ2iM6lfOTUJHEwi+nfTng2QaePK1HXtO1CFRNiGA6OWmwbECoh1Wzu0F1A ANCZX8izkL8CS8CUsKoz+UxW79Fc38RSEaCJ2ES+FKvHEsPczIOidojCHT+FamLIs7i/BP G51GDs2q8gSiD6iMR8/s5yh7w1cIpGc= 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-462-oH9GixdAMb-EbAALXlbI3w-1; Thu, 14 Jan 2021 05:37:24 -0500 X-MC-Unique: oH9GixdAMb-EbAALXlbI3w-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ECB9219251A4; Thu, 14 Jan 2021 10:37:22 +0000 (UTC) Received: from laptop.redhat.com (ovpn-114-165.ams2.redhat.com [10.36.114.165]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D9477047A; Thu, 14 Jan 2021 10:37:19 +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 v2 2/9] KVM: arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION read Date: Thu, 14 Jan 2021 11:37:01 +0100 Message-Id: <20210114103708.26763-3-eric.auger@redhat.com> In-Reply-To: <20210114103708.26763-1-eric.auger@redhat.com> References: <20210114103708.26763-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.21.3