Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3516415pxf; Mon, 15 Mar 2021 11:16:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwb5lAs++5Z88or6bYBy88Mny5EpmYEvYIiGX8R/kImZ497TqiouC6T/gGqBNYX1SWoTH2z X-Received: by 2002:aa7:d792:: with SMTP id s18mr30981178edq.176.1615832199501; Mon, 15 Mar 2021 11:16:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832199; cv=none; d=google.com; s=arc-20160816; b=TOnwxUUamJOXQ5T8rP45fW889d0m+l0Da0zIp1Ll5kUUersSoVZosXrdXWu0x/Dzh+ QCUwAPG0UY4kvJjYZmzVnQYgeisDpPy+CkfajoVK5YbUoZomiRTLlGyFD1PtdE07AK8h MrA/hJzA+MjGWFLukqC4Y37k6BFSudUQpxhkDti0LjxKPQchKhtGvoQ09EvgtdU4TOna gKTtqwTt4ERppQYxcSFPwswvGpWX5l0Bws5ISAoHwm02aTPhhIkQucYEkB9IxhJtIQMa D6i19JeWs5SqZjW2szzq7qTQk3nIMaNM3rM3Ev8iONOHpCzlgk5+8g8mizTmjjMaE3En aRTg== 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=VCT1xlGq5q19Zw1yVRUF4qaKyM9NX/LP4TkwvyYLP2M=; b=c8Ngvs49wwuxEIjvPt4JS0we7oHiRyE2sJ8aTdRjlKLpe8xq6S1++Ugdx1wuShQ/Rh 4yvq6WqDzzN9dEjm85d7zPwayDD//61l7n9bbohuYZawKdvs/7jV2x0YjKsZ8xZx4e5D BO1PZ2hnjgP0+KI2/1L4F7MbSR0OYAGjkXsbS5vgc5ohDfm5MrdsTaYUYUg94ccGYBMD ANLKif5KgoTc2km+7Lm7JVfn9M2d54bz/rMsKEjLpJtns5BPLNKpKwcyFAdJCuwyTYlW n76Tx4Osho7vcO9dx1Vim5/8ehZ5nL/10ochHUa7whKrvHdt0E6g3E57D91e/zhwguv/ pAzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UJyzos6b; 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 b5si11371677edq.537.2021.03.15.11.16.16; Mon, 15 Mar 2021 11:16:39 -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=UJyzos6b; 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 S231548AbhCOOO5 (ORCPT + 99 others); Mon, 15 Mar 2021 10:14:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:35446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232527AbhCON7B (ORCPT ); Mon, 15 Mar 2021 09:59:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3D9BB64F06; Mon, 15 Mar 2021 13:58:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816725; bh=I0xtAo1np7bMcLhrvmMjf/dDehU9BTJONjnWPU3Uw1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UJyzos6blhnxDIBEF9SFs9x3kpI8MZlqY3QFzhnIJYvhsf/ApXaUdbfNDQJXSMfpb LOVbMeviNSmUcPLnfWbLIqsm/CrK7i3C7Pp9wGGev02j0Ts6ANM2wFKI2v0IcnpFft P1/nLmprNNTeEXNg6FjGYHhauEc4m8oays1y7d0o= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wang Qing , Heiko Carstens Subject: [PATCH 5.10 077/290] s390/cio: return -EFAULT if copy_to_user() fails again Date: Mon, 15 Mar 2021 14:52:50 +0100 Message-Id: <20210315135544.521135675@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 51c44babdc19aaf882e1213325a0ba291573308f 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: e01bcdd61320 ("vfio: ccw: realize VFIO_DEVICE_GET_REGION_INFO ioctl") Signed-off-by: Wang Qing Signed-off-by: Heiko Carstens Link: https://lore.kernel.org/r/1614600093-13992-1-git-send-email-wangqing@vivo.com Signed-off-by: Heiko Carstens Signed-off-by: Greg Kroah-Hartman --- drivers/s390/cio/vfio_ccw_ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/s390/cio/vfio_ccw_ops.c +++ b/drivers/s390/cio/vfio_ccw_ops.c @@ -539,7 +539,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struc if (ret) return ret; - return copy_to_user((void __user *)arg, &info, minsz); + return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0; } case VFIO_DEVICE_GET_REGION_INFO: { @@ -557,7 +557,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struc if (ret) return ret; - return copy_to_user((void __user *)arg, &info, minsz); + return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0; } case VFIO_DEVICE_GET_IRQ_INFO: {