Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3512779pxf; Mon, 15 Mar 2021 11:11:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTwfcX2DQKZhiO6Pora9CuIT6Ohmn3ErmKQrdrJcIVhETfyVxoCRsx8CU/o6C84H3efn5Q X-Received: by 2002:a17:907:3e8c:: with SMTP id hs12mr25233913ejc.105.1615831895668; Mon, 15 Mar 2021 11:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615831895; cv=none; d=google.com; s=arc-20160816; b=xXWsqfm1h9fKAO4prCqNB//0wRpfrsRJjsGtX2ceGNwUC1OzLmb9Zv0zpc0e5tIQ+f Gv34ih/82BJoHGDpi/BOmlomrJPUivF81nFJgBUagh5sefjmvnizX3glHrsv+FjFxWJz UGRPXYPFVvpqwazTJCylYVmlt+nkRHiVkyZ8mtoFEa8sSusVr4537gaLusSpwDCJMgBM mde19utkw3xkGrmwVPrRgIXMuYcQL/kS+SUBNkspH8JWc7Cv+UeFo29qZAvxXyQg8BBp 5p+7SQdjar2HG2AR4XyW9kWDPlG1e+5RsO7wIedkbsOSA76Fur26xGvDZgck8YUWd59R 3lkw== 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=ZoFXs6sAJLAPGsrDxFJTCwgYGReDKm+7oQCzcYZCv8LtFbRh0ulfP1C8EI6LsUw8l4 7H4IKhYb4wEu7Vg0NtKgbujkHGXaq7Shmh0RU0cJm0Sm1tuJftOyUeTTqMz03Xn95W2u Pjhe61xN9oO4Eji/O3hvPVuVTyhp+iLCPo8tV8AYF4wgeQMqtkI6iJYuaE6YDhHrjcVt 7VC/FOUL5Yd7792FW+kZ8qwJrquFSAAP8tqQatPnW+pX92Cb9RMnhRmCGR5Nzj1Mnh/r JvTRQm7OaN/NRHb3e97W47OLQLuSuvBbh1ZeEPhW8MFviR0o0T4FJucguBzwJwmXG+/D ZgWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XlnLHWd6; 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 n23si11623936ejr.458.2021.03.15.11.11.07; Mon, 15 Mar 2021 11:11:35 -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=XlnLHWd6; 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 S231184AbhCOOJs (ORCPT + 99 others); Mon, 15 Mar 2021 10:09:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:34900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231425AbhCON6P (ORCPT ); Mon, 15 Mar 2021 09:58:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5B22D64F04; Mon, 15 Mar 2021 13:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816695; bh=tfw9hM7u/vNj38cvdyB2pem0hkF9GvyGgV4TjHoKQ1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XlnLHWd6Gbjvpx33Tog/gHso5JMYUlPV5lg6M/YVaKU3Dy9ATOoWoAHe8nyNIK0hG 1vdzLZKIztbmLnZTQwo7yG98nevKLaeNrS5p9KBOQlOZUW78dYn++hnvq1VhPmTejs 4TtZeN8ITBWMRkS/LCl5X+RUmB2HJaGSfIn7JiG0= 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.4 052/168] s390/crypto: return -EFAULT if copy_to_user() fails Date: Mon, 15 Mar 2021 14:54:44 +0100 Message-Id: <20210315135552.067650080@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@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,