Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3522027pxf; Mon, 15 Mar 2021 11:25:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIyRvzqDtKMdCsC9JnvidOLCAZ7YKGyTAww3gsZEmJulKMqQvMUgkUmb5F1g18VmTTnpJc X-Received: by 2002:aa7:c14a:: with SMTP id r10mr30338514edp.132.1615832723792; Mon, 15 Mar 2021 11:25:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832723; cv=none; d=google.com; s=arc-20160816; b=ae9bg2gow4yzNoxYxdKrp0kgAeiQnPqQRV/gT1pgeqT6WeNO0TnDDRgZzrXRc5WQfL IS4wJhJQEozihWG3dfxZhlmuhnxgPMtXgLJpD2l6Rj2qcYC5KdjlKjNZhGdrVYh9qPOu IEtJp2swYNkJ4jVNKN3Mxi+kMpUH11/T+hdRgAKgi3CJ60zcQAyuN5K/6CZyZL9F2e78 KUZBJnUdz4bbysWbKVBUz6hvORaA4jDAM8snzI9mCE6vbGpM66+I9ykM1v9h+KK3Cgjc hV86Kh6K39gzIExdiTm/MRjCzm+EFgMgA8m8Op2yyUj9hb7Wc3EdiY6uoyhi4Zqm/Ygj jdQw== 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=PlsH/S0ZRaCPMvESc53ImKjkbW1HDJehAEvWkGNpnyY=; b=Zrb9KwlR7jri/ZQDJKB+RMQHod6blzLus5rk5roJ5r+lOyRwD9fEXy69M2BYxOTi5w Cp8ZNia/gTU+HjI+IFRNOxQ/S5nTI5duHzZQFch/+9+D6wG1jNViTDHUmw1qgxl5T9au pLu8z1zkNsd8H76s8o2NXCAjRQGIB9dX0xFj0WoJCeWGdggjd/DfVfPL2j5YXWtRbQDP eTCcgntBNcjpD28Z2Zdo5wMcIYDkcGqnRVOE4Sx0UzqX9uWQf4V1C2MInxCtAyri375H ejrhFn0Ee+6uPb6qwZxuv1FG+dUDt8dGawNy7yJ3giDj0SeRWKSbM6rJZoe/5dNyP7+4 SrrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FLxuMgr8; 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 i13si11421988edq.522.2021.03.15.11.25.01; Mon, 15 Mar 2021 11:25:23 -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=FLxuMgr8; 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 S238797AbhCOOXp (ORCPT + 99 others); Mon, 15 Mar 2021 10:23:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:37836 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232838AbhCOOAB (ORCPT ); Mon, 15 Mar 2021 10:00:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3C38264F35; Mon, 15 Mar 2021 13:59:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816768; bh=ohdxKrbSCejBaNoFuPl6id21e1/qfOyVMwssfR/tFzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FLxuMgr8TMQKl1V2yV0cy1nLYojYC9BDU2qiWmy6Ic1uA8KOs/zfyIdzD5n/KMY0i LI877A7ntJFlSrLz0Vb931wNLgtcsTGlDO8DhQAtLiwYckAN+Aq6BYVx5iIQt8r3Md QDkkHm0KYQ3yvZOKainCKGO8WP/sLt7Fk0ZC23oU= 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.11 113/306] s390/crypto: return -EFAULT if copy_to_user() fails Date: Mon, 15 Mar 2021 14:52:56 +0100 Message-Id: <20210315135511.464881720@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@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 @@ -1286,7 +1286,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,