From patchwork Wed Feb 9 18:09:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12740728 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54EA3C433F5 for ; Wed, 9 Feb 2022 18:10:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C99510E3AA; Wed, 9 Feb 2022 18:10:21 +0000 (UTC) Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD76B10E3AA; Wed, 9 Feb 2022 18:10:20 +0000 (UTC) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 219HCch7008857; Wed, 9 Feb 2022 18:10:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : mime-version; s=corp-2021-07-09; bh=tDRAJjWRDkzjOBT8Iie0acpYa/44x3BoTHDf+KqygiE=; b=Lg1/XHe6h22QXFIwB5pBs0ez4PNpWcrJ8VeJC0PM2T6yeXngY6jU8pgtshtUFeblVWQ/ FaUe77YbZ2GuDVK+t8TCfey3JdZT4Fvt20a+S0SimPW9oKj8JOrI9cTthvF/PMjtRAj7 ZWTHawlrSgy/pK65E8KfmfGxe/YFXuAZB7yQJ6S0tCWVpfNt2H7EAQ0myG4dR7YisI8+ lULcjBrIP3ZAHYhaJA25sha0DhtwJFsMjc0+thEr0BNHPixYQ902nIvYFurVPn4Nrq7W u+iIpZR47Zb3SCtZsGjxYGFoVgN9x1ZnB/70ncTl3aqupRxHK2eRIQt3zBfZBa/du4SJ Bg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 3e3fpgnhy5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 Feb 2022 18:10:16 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 219I1b0k104142; Wed, 9 Feb 2022 18:10:15 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2108.outbound.protection.outlook.com [104.47.58.108]) by aserp3020.oracle.com with ESMTP id 3e1h28qjt9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 Feb 2022 18:10:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C+Ioit7IpUgEaTGH2jthikXNjyE3sosX93MO9ESdEuXBZxRDe88ks4LEZb2R+lNxNV7uyyGUi7n1Vlvj/i/iOIqV/KH17GuB0iPFRs7fE7szGBHy1+nBdGQiN8u/RGBr4KFfwD7dbiTTwS8Vhu8R4XhdDFWaMAqU5krrt2B1qq5WWKXCfQYUGSEbZkdrcY3dp1qzZ7X58E8TNrNlf+oq9onhD8DmThv4plOBPmcZG0/wWGQgAt4w6LhPsteLM01Ek2aR2sOpUMzk2X1VkyrRKqpuVAK5u0pQJsM62dYnaH4JXcy3XTW712Kl3GhZbIXWbRPwVvANOrSMVl/E+PISjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tDRAJjWRDkzjOBT8Iie0acpYa/44x3BoTHDf+KqygiE=; b=iUuKqC4NAlHzlAJf1B/hHqV/F9s/rnHSAfE6DvFjP9TOYdLw8Q4tZlcN2yz6ZqD4/iBbrr94mkbR0j1d593YSNVk4N7oO9dmWF14zWIGTg+A+dXtqedqQy/qf8kOoW6uYx4eCKjkKjE4ZYfF62CVaXPvuy0v6iCidEg6aBZ67ZtLDQ4mmmCO3tIL1xhiZcRe6jpX7596azSfKh5EwvsvEX1NgM15Pr4I6hDP4dGuCcmIruYuE/se5ycWQmNLXvIwQH8FgI71AKp4z1HZ74kiKgX6QF8hL/+odFvmls47XMYvG7V/to04IcV4kis/rxuiogYnFZPgbXoJjbJQ+4xgBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tDRAJjWRDkzjOBT8Iie0acpYa/44x3BoTHDf+KqygiE=; b=z81NLU+CLf/urMaJqJSpj2vSJBJrvmCvmt2X2UhpQX/80udP390FrFC5kMgBcXWO2bRZe0x20RObt4U07klQW34F+SFyAj+9r7zg3MtVUbg7k7+2gE2x3OPaGNXlUC+pnUBWF+gDhfu+FCsON7qYECix9WUFhLhNVjzKImQttVs= Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by DM6PR10MB3353.namprd10.prod.outlook.com (2603:10b6:5:1ad::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.14; Wed, 9 Feb 2022 18:10:13 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::e5a5:8f49:7ec4:b7b8]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::e5a5:8f49:7ec4:b7b8%5]) with mapi id 15.20.4951.018; Wed, 9 Feb 2022 18:10:12 +0000 Date: Wed, 9 Feb 2022 21:09:59 +0300 From: Dan Carpenter To: Felix Kuehling , Rajneesh Bhardwaj Subject: [PATCH] drm/amdkfd: CRIU return -EFAULT for copy_to_user() failure Message-ID: <20220209180958.GC18385@kili> Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.10.1 (2018-07-13) X-ClientProxiedBy: ZR0P278CA0166.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::13) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6b11c283-df02-404c-df45-08d9ebf76a6b X-MS-TrafficTypeDiagnostic: DM6PR10MB3353:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z+XRrVGuFc9QRvJZv0Qa0Q+6832IcHV5bGhc3t6P5VuYx2fFoSionm/fwQRyQPFeC717tHHkXqVfHr6OTH3cOs0+UzUSnMoiyvUuMsWvXtXclSyTJtWHATAnlC9peS5cql665CuQax+1z9nd9TeCbG8v0CZsZiRnz0fobKDlbHx+pfDunpUKCdCICF/RNaNy6co++01RsGyxz2IIx2SZjgjAThP/MO0b6ixRwTxGT1mlWLINKv/dIXs69zqyAjyXL3CzqjsPBAOj2YEJHSVOsxHq7pD2BVBkPGragOMVW+PvNdQ/EkhJZxMTFzbTjP8VIw5i2k9uxOa2RxbmJCOcR2UoiCmSeXqKPUuHIm7SLwesExBX6Z29KYAppX2w6IBfkD39ksRvmzj92WlR9sBjaR2Chn6ToaDrfFL4sOgvppf6GxQ8w0NgejPtnTNeVZoDlzkiUmPx/o9SkW6lXzNqnSkXdAzVRPh7wx0LGSoTcRwMKLJgkSc83ikMiYhbGpx9FwV/LPT7/Xc+0TYLfJWgGKgUF8Qwa24AO20ZeMtkRoQWZTJIVc+54SwbVLjf2Uqi2CQan34LEZvOZkB1WQsVezP8rS3MsVweF9IVg6xlsnSVpVVIBn6F29zBSJ3AjLg+rQjwoUTzPrqVX4cr3O1gDd06U/L1ZKo3xaGx1zBmK2gNuRzrGxyt2pUX2AOAS0iIvIefymU5bazxBZKAduAxPw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2365.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(7916004)(366004)(9686003)(66946007)(186003)(1076003)(54906003)(8936002)(33656002)(52116002)(7416002)(6506007)(38100700002)(26005)(66476007)(86362001)(6512007)(38350700002)(83380400001)(4326008)(6666004)(8676002)(66556008)(316002)(4744005)(508600001)(44832011)(5660300002)(2906002)(110136005)(6486002)(33716001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Pw9f2GX3BEKOPRWW/69Uew5H0l7BlAZiV5fAU45GcgnXuWvgnbmQsofjEDocjN0azz5cuiwN1TeupSP4F5M8tBbdz8MwSWFjWgxarKgI6hMqSaTLYkNH8Bn02bm07rSxJgtUHOMrC9xVl3L9xfqKvB9NuwVnR9MVShMygEosrHHYbOBXMvl+Nuo5OmwYYRVSGw+bgxtdtDhv8Nn/ZNEAc6HfqSREzN8nmW3fpdUntvLFhOIcA2XnN/WSj1P7n4g1qThlwcPW1t7wpA6EmGft6Z/VIh2bF9x895ihk73AxFn3oxrV4JDK7gjSAuqbYyD51V8jIdeQCUljb7evio46FFzx4bdm+MJHFlskFY3TqERjswCX74wSGbbtFvdDC+wdxvt9xAOEkzJmS9SV6BtjFhlinztpSM7fwdjO6PgoBfHYC1RZVxIrScLt2PuwXUFr53C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fr9ile9zZwyRO/70Wq9gVGEt46r7MjeA6cnIOrhrM7Qp9H9ufT2yN7C2O3If4IqeuNsFqfsSxbD+hESVASKM77RuWR90UyR5/gwJGhDC8WiWKm7NThjGP4tlIi1x7C647mvL2+7zKS2kVpG8Rg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b11c283-df02-404c-df45-08d9ebf76a6b X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2022 18:10:12.5633 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CVNrEIOMrRa+cMW+ucfDSPpP1tQnTw9c6WWRmuMmTbsymq+J0+tvqsFvxz9HUj1h0FCuiYA7+Y6r/modexY4idGifCp5uc3nvjNyG9Yf4QQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3353 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10252 signatures=673431 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 bulkscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202090097 X-Proofpoint-GUID: wLSUt1Z1RyC6QbRFYn8m7S4ERB-ICh6O X-Proofpoint-ORIG-GUID: wLSUt1Z1RyC6QbRFYn8m7S4ERB-ICh6O X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , "Pan, Xinhui" , kernel-janitors@vger.kernel.org, Rajneesh Bhardwaj , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Alex Deucher , Christian =?iso-8859-1?q?K=F6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If copy_to_user() fails, it returns the number of bytes remaining to be copied but we want to return a negative error code (-EFAULT) to the user. Fixes: 9d5dabfeff3c ("drm/amdkfd: CRIU Save Shared Virtual Memory ranges") Signed-off-by: Dan Carpenter --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c index 41f03d165bad..38a056fd0966 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c @@ -3775,10 +3775,10 @@ int kfd_criu_checkpoint_svm(struct kfd_process *p, goto exit_priv; } - ret = copy_to_user(user_priv_data + *priv_data_offset, - svm_priv, svm_priv_data_size); - if (ret) { + if (copy_to_user(user_priv_data + *priv_data_offset, svm_priv, + svm_priv_data_size)) { pr_err("Failed to copy svm priv to user\n"); + ret = -EFAULT; goto exit_priv; }