Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3515350pxf; Mon, 15 Mar 2021 11:15:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsyEknJ4m5iREyUd6EFFnrMkvZ8w4c99j2mUA7Ri7wOw56q4PsrdEog3kIAE0o99z7rFXr X-Received: by 2002:a17:906:cb0a:: with SMTP id lk10mr20313212ejb.479.1615832114418; Mon, 15 Mar 2021 11:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832114; cv=none; d=google.com; s=arc-20160816; b=U5y7CiEd8yIcy/I0P1UPrET7jb6wBx6sJHXg1R3Ibezegi6hXkfTcnhiM4goSeBNe0 6qjFZHNv1Uzm0EWo9lwhrigW0qMLbT0MDGtGSdVP59NvL8j1RiI4BAChvB0Cv4pIX4z4 0dPKUhFsfgXDKw+dkM/wyBTlkL/wWjeHEnxizHM7LqBwmYoM3NBhuYv0RC1jnTCFzi7g gGqgwfvi05oQozYUGZhM4CPEDxZ745246oXp1JEZbgPTD8F6LodXzd/E2r5eIzEKE+W0 lrluSonrZidIXq5Eo3NYvmhlT1gf/CZKL8EuixHv+sJ6ztFunSIUCSqmcY9ug1CSwPPg rKNQ== 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=hldmNJqa6y5uX2rL5396IDPBp+tN5l0rLu5tWctuUUc=; b=LVKLfTsFzqeX63VQZarywnMKM5OzOLlNbImmhXJqaC9ajl/C+rFbsH+O3gfkxuo81f 8zKHPAZ/FRADxaMl2Pk5Wax8hPnUuEBfDnHPgIKtL4cmXV/4Zj/DXYIN5msL4waiqBji sPiFDkkHEleXzCDSQUIdTKEZ+CcfwaKiGLTc2pQcy+67TfJaUu0bZ1Cgd390xNwz1W6P SMo1zz2036/BNmO72zcw6cAhhmo6rddQZAcD6QTvJ2GfdLMZq49umIF7B+JxAo3e2j5T dIIRFZFgo3juFCzlrn3dupn0IfiMVQr27EJ+QEbbb9wbyer1xzTKwRw4wPAOPq39uJEF fw+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YWr8Jt3l; 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 hr14si12262646ejc.394.2021.03.15.11.14.52; Mon, 15 Mar 2021 11:15:14 -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=YWr8Jt3l; 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 S235932AbhCOOOK (ORCPT + 99 others); Mon, 15 Mar 2021 10:14:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:35186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232565AbhCON7D (ORCPT ); Mon, 15 Mar 2021 09:59:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DCF9764F33; Mon, 15 Mar 2021 13:58:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816731; bh=FAEVE6XHouPTJcwLoC8YlshzinAWao+eLhloMA++pAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YWr8Jt3laxSuakzOUHLQIloDTAT1SVcJ13keNROp0K8ayxZ/SgQSxKWps9liEHKqL Jjc+aeCfBSFTSJr9ubBdH/J9Cgee4OkYCTHq9JELu7Xg8F9bPUEtw5P3a4v7Eqvq57 OcKlOwMpeBsnlPQpnN5wzWuLgBtEroePRSPd3qAg= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wang Qing , Heiko Carstens Subject: [PATCH 4.19 033/120] s390/cio: return -EFAULT if copy_to_user() fails again Date: Mon, 15 Mar 2021 14:56:24 +0100 Message-Id: <20210315135721.076757562@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135720.002213995@linuxfoundation.org> References: <20210315135720.002213995@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 @@ -341,7 +341,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: { @@ -362,7 +362,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: {