Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3518071pxf; Mon, 15 Mar 2021 11:19:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkAaklcPCbkA/bF2vrDhKZr8DDOusb2UYqMCksxBaOw0ICWzY6POTXGmcL3o/Hhbdgzrns X-Received: by 2002:a17:906:1352:: with SMTP id x18mr24680082ejb.545.1615832355788; Mon, 15 Mar 2021 11:19:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832355; cv=none; d=google.com; s=arc-20160816; b=F/FLr85vcqtUd40r+Hia4ClGSgfoJd+MF60W10M7jtLh75Bw/d4gz3DApG8bBO64Ez gTqzcXykeHY6GrfrzgNjLTwls+n8vXc0YX188vnWoaXTITqwwRFERJ5inE8+0lvIGHsZ /lkVRN/On+PJzv6N2xDNIzN6ljwyt898sh0d3srQaX/1vaN18V65h9V4xKxHdJ2loZnG EyMMoLAK+7Ch+W1Dio8vcODp7QVtQJP/hgusdeqig2Y56H98qBtDgAGPIxmKmHgR3lTe z4YwnNRibV41DCyDK+ZYnRo2oQ+xP67Kdjpgo0bYi8lHbOEzw/rvUU19r4aipGplNmSz i80Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YXOhKfQl2PzBWBtO/Wvqzp9tQpz2lGRg/MjN/6d9r0Y=; b=Vn7SzFBCKaF4c09kn4A5j+HkDE4d0nADlxim9hLJRgCRJAGOj3k1A3XY5QgWIZguPN IDT2oZG0q2VsuzBQpoald65bSF8QHVkgrXfMH+yDVwW7n7McACoYYXT7ma0UJ5gULVfa eqhDfKrilhaHiPJ6h5po2UX5j+jzs5Dv7lTAVa0hjbefOIQ/uU5gFPoTGO/y3lwZtZxm TSkvKY0NmzInn7kWnyCnW2zcSCnNE1+IpP45FIcoMwYHaI26ZJFMqGcOh/ShfCt1Jc4Z JNTBCc2Q9fRM57/QmY6U+aQ+OlL8BddgqFWJ5asL+oBGTIwQks+u41PFIZ9Whle8xZ27 PP3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IrxLhg9M; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w25si11622190ejv.100.2021.03.15.11.18.53; Mon, 15 Mar 2021 11:19:15 -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=@linuxfoundation.org header.s=korg header.b=IrxLhg9M; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237386AbhCOORp (ORCPT + 99 others); Mon, 15 Mar 2021 10:17:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:37612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232745AbhCON7i (ORCPT ); Mon, 15 Mar 2021 09:59:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B369964E89; Mon, 15 Mar 2021 13:59:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816761; bh=tfw9hM7u/vNj38cvdyB2pem0hkF9GvyGgV4TjHoKQ1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IrxLhg9Mb3kyesczh1IZ0qXoVoPEDEk8d3V5FPx/ysRbl/0NsqWbK3Y0jSLwxGNs3 vVq9aZRgfIq6wUKUmeeagKTDqgaITY+8t4LHRXCUJMDKM7RyaQf7AxAPe59blkSt4g fBJ9jZXdUYd6yZbdSiDqLw5colQHLFlSQ3OsZpLc= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wang Qing , Tony Krowiak , Heiko Carstens Subject: [PATCH 5.10 099/290] s390/crypto: return -EFAULT if copy_to_user() fails Date: Mon, 15 Mar 2021 14:53:12 +0100 Message-Id: <20210315135545.268222714@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Wang Qing commit 942df4be7ab40195e2a839e9de81951a5862bc5b upstream. The copy_to_user() function returns the number of bytes remaining to be copied, but we want to return -EFAULT if the copy doesn't complete. Fixes: e06670c5fe3b ("s390: vfio-ap: implement VFIO_DEVICE_GET_INFO ioctl") Signed-off-by: Wang Qing Reviewed-by: Tony Krowiak Signed-off-by: Heiko Carstens Link: https://lore.kernel.org/r/1614600502-16714-1-git-send-email-wangqing@vivo.com Signed-off-by: Heiko Carstens Signed-off-by: Greg Kroah-Hartman --- drivers/s390/crypto/vfio_ap_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -1279,7 +1279,7 @@ static int vfio_ap_mdev_get_device_info( info.num_regions = 0; info.num_irqs = 0; - return copy_to_user((void __user *)arg, &info, minsz); + return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0; } static ssize_t vfio_ap_mdev_ioctl(struct mdev_device *mdev,