Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp320557pxf; Thu, 1 Apr 2021 01:54:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZQ0dspW4hs6RNjDrhoG/FqLNFX+1NDSsViYwD9pXYpMt9jbVXiB60oIxoOioFMseDTc5Z X-Received: by 2002:a17:907:3d01:: with SMTP id gm1mr8088548ejc.214.1617267272558; Thu, 01 Apr 2021 01:54:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617267272; cv=none; d=google.com; s=arc-20160816; b=vD8tixGGWChKtXwlas0u+EfQXAhmUgNN/7xF2rTMlIl2Gm/RMv4TUpP3KuwYu7hsCM YWeMEghsZrAZCSrMey0C74iwkSYgl+XhAmUugtyeA7vpUAvE5KdmLZYylUblkitzbHVz zim2GTxdjKWFVOtcsRCwIiaLYF4Kuncf+ZyxoPmNZC6UcZihwjydHy5hyUOdrz3afYoR 78vaJ6+Duaf1uHoJ48XMcXjCFl768B3NqtBHYgk2PC8mrpOphDaYq9WhAdMOAWcRKzWJ i4X/GfLGAsqjMJepnbAfDyFrawUwW4VmsZPNEfIuGXOx784Ro74pvcjPqPMuhezoZ4Dr XYVg== 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=mhZSXvwDwJuBlcRF91oEmJLWfxeMxVgFzfRQMi4oMHg=; b=ErbTPcnjXJyL6JhgAJxqb/FSOyfWnrvdhqWIndYxSg2TszzAokRYNUkMcamIdmwad5 tMCpaF3+ajVItu/Y+6OorypBrCwNWLWdqmBoQzITujQDlAQO2fOa58M/lXFqXs/8Xk4I KPFbK0ckgUTcz4oWvSioXzR5zA4hqmP0t5Wq4ciUTRVVJGGpownkQ1zymbaqQBbc+sAr /r1+WrYqqMhsw8YTGENhLspalKDuJCoEsrEdWN3ARd+GnyMCyAKKGvJDSmQ0Y0qjxzHL 5asIbd7o6gNvd0cp9InV6hmbGSMBi0xtIpSm55yqaqTNZzW1y3ug9pW65cZ9LuigvA/d xqJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LFNxLixk; 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 y6si3757102ejp.143.2021.04.01.01.54.09; Thu, 01 Apr 2021 01:54:32 -0700 (PDT) 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=LFNxLixk; 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 S233767AbhDAIxT (ORCPT + 99 others); Thu, 1 Apr 2021 04:53:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:42659 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233258AbhDAIwy (ORCPT ); Thu, 1 Apr 2021 04:52:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617267174; 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=mhZSXvwDwJuBlcRF91oEmJLWfxeMxVgFzfRQMi4oMHg=; b=LFNxLixk5jwqLCSrVmyA7YANFS2Ns+KYu0/o2XDuXZBWO3OVkfWsojtJyfcpm+w5DIgpjR P1R5A9/Xu3KVbB1yM6Yfz/h+kkQoQ7J5EAaVzdrZlqWHjZonGgXvayblI/lWAgO1xm3sH6 BvDu4NzIkt1PFF7diYb3nfGXztbdcmM= 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-476-808oxu-_OVaRBC5qHRnr9Q-1; Thu, 01 Apr 2021 04:52:50 -0400 X-MC-Unique: 808oxu-_OVaRBC5qHRnr9Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 689B6108BD06; Thu, 1 Apr 2021 08:52:49 +0000 (UTC) Received: from laptop.redhat.com (ovpn-112-13.ams2.redhat.com [10.36.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id C73AD5D9CC; Thu, 1 Apr 2021 08:52:46 +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, suzuki.poulose@arm.com, shuah@kernel.org, pbonzini@redhat.com Subject: [PATCH v4 2/8] KVM: arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION read Date: Thu, 1 Apr 2021 10:52:32 +0200 Message-Id: <20210401085238.477270-3-eric.auger@redhat.com> In-Reply-To: <20210401085238.477270-1-eric.auger@redhat.com> References: <20210401085238.477270-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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 44419679f91ad..2f66cf2472825 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.3