Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp52126pxb; Tue, 2 Mar 2021 18:50:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJw3/mg+88/alioB9FadjCuakmLSa/v+ZcdNRkUPiKlvWIY98iR6LV2t2+uJMJxnnImVjygZ X-Received: by 2002:a05:6402:124a:: with SMTP id l10mr4007147edw.122.1614739854376; Tue, 02 Mar 2021 18:50:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614739854; cv=none; d=google.com; s=arc-20160816; b=NKgVG5QgTnnSR1zZCfDZ2jWJcPEEEuQLpCkP9/JuIjTZenZSGf8slJ5wKHy5RcWo2M T8yZKb3Mr6slB/pHsADeplibL93AyC/RaiIKoYiVVAqIsfuxovcNqHljZS9iNNAI3Me3 V8xg/J7G3xZeVzVc+G4kvK67dO4cCuHhJy4OY1qNFSPBA9SsAE546oCbyLDwpvILbeRu S6ovTletxsIfpoAYoscwU9FR1G6udniVSBBVsM02hgbUJXK7BsQBsQd9N3kVD9AxHuO6 sVW5lBPkdHZjp4mSHfMQBY42eQ5MwOMfyk2stOi2vs0NOJDQLvuH2RzRWX1XRNX7SW6l wBkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject:dkim-signature; bh=vnsvBUqg5xQG6q7AEDJKtyaLYYemmZ0hyhGWhSRqm5A=; b=bJQ75QxKHFRAdm/JivkAgVtRFlplYjphVlZc1lFL23Vk+Iotsr9ooWdVIYpYIepiA8 xu0hQ0Ot68Mq2Vb3CZN2nri08UDqKR3mB/WyJDiFcw1J0+r/eLWwOAxN9o8mWSCBv+PZ p6J6FRDD7q7cNUKkx8BSGCIOPpPhsIBlXIpKRxb+Sdia+ZNn4JwlfnvnYssFn5ibrLLx FGBiyVJnCQOBHSecj5VYr7Em+zyZK7xv3+3mIHhedmMm9KN6ddac1i6hbo2mTT1kjAge wDlX1kL9xbyfJlW+Xf5ec1e2KrWjnQuzHA+PUfoHlgLM0SG6pRtC/BJHK0IhEy7Ndk24 +nKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=TJTD9FCb; 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id he10si14410094ejc.486.2021.03.02.18.50.31; Tue, 02 Mar 2021 18:50:54 -0800 (PST) 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=@ibm.com header.s=pp1 header.b=TJTD9FCb; 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234075AbhCAMTW (ORCPT + 99 others); Mon, 1 Mar 2021 07:19:22 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:27278 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234139AbhCAMTG (ORCPT ); Mon, 1 Mar 2021 07:19:06 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 121C4XW0121645; Mon, 1 Mar 2021 07:18:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=vnsvBUqg5xQG6q7AEDJKtyaLYYemmZ0hyhGWhSRqm5A=; b=TJTD9FCbzim2IfwSGf0yXpONyGpkJ7lX3dYsiJq0gK234Hmt9ajAQdqoQ7poXgAM5QET Ig7LPyL2kLkS+f3uHrZ8x+SFr9EU3gKywHFGS1Ci60KAj6rduljJk/ceD+dWE7RztNCb lukZ2+p0ehtfiZlzHcq69/xkxxhtxvGOIvSuaKi/H0xd3H6LikEFK4qjaPGiwP0x3AYb JIxXwAeQ8VTYJXXX3m/07Dz0R5F0MIPH2km4fOQ6et1MeONk59C3YD1zfkiSAkBYm++1 Flfudhl5f1HuwyDikbf79VU7gk16V0bn0fRwZ4aIoIHgavcQZ8ljGhLmZjdxFeZtNrbk tw== Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0b-001b2d01.pphosted.com with ESMTP id 370td0kqck-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Mar 2021 07:18:25 -0500 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 121C7njt016739; Mon, 1 Mar 2021 12:18:23 GMT Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by ppma01dal.us.ibm.com with ESMTP id 36ydq92gcx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Mar 2021 12:18:23 +0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 121CIL2528901720 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 1 Mar 2021 12:18:21 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 581A6AE062; Mon, 1 Mar 2021 12:18:21 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DEB70AE05C; Mon, 1 Mar 2021 12:18:20 +0000 (GMT) Received: from cpe-66-24-58-13.stny.res.rr.com (unknown [9.85.150.254]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 1 Mar 2021 12:18:20 +0000 (GMT) Subject: Re: [PATCH] s390: crypto: Return -EFAULT if copy_to_user() fails To: Wang Qing , Pierre Morel , Halil Pasic , Harald Freudenberger , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org References: <1614600502-16714-1-git-send-email-wangqing@vivo.com> From: Tony Krowiak Message-ID: Date: Mon, 1 Mar 2021 07:18:20 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <1614600502-16714-1-git-send-email-wangqing@vivo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-01_06:2021-03-01,2021-03-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1011 adultscore=0 suspectscore=0 priorityscore=1501 phishscore=0 malwarescore=0 mlxlogscore=999 impostorscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103010103 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/1/21 7:08 AM, Wang Qing wrote: > 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. > > Signed-off-by: Wang Qing > --- > drivers/s390/crypto/vfio_ap_ops.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c > index 41fc2e413..1ffdd41 > --- 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(unsigned long arg) > 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; > } LGTM Reviewed-by: Tony Krowiak > > static ssize_t vfio_ap_mdev_ioctl(struct mdev_device *mdev,