Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1317555rwi; Wed, 26 Oct 2022 13:44:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4bGbY44r/H4YYZ3ylZo6lYM69ZPQt8ZC845YIVNT22U9n/qgWq/sQCmIbvaZhWBazzXhNO X-Received: by 2002:a63:804a:0:b0:46e:ffdb:5628 with SMTP id j71-20020a63804a000000b0046effdb5628mr16023317pgd.463.1666817059922; Wed, 26 Oct 2022 13:44:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1666817059; cv=pass; d=google.com; s=arc-20160816; b=xgmljN/5cxXY1x6SHjUyaUTfQQqQ5nXH/nCYlUiD62YHGfdMlM0bUh0w66Z/SSCnXW 6dpgnaVuAfBhvrq4R5nZtq/69rtt4ZGHuSDvglzXXo6DO0Ed/2hMrd4HD2e5DrZpm3NY u/GGy48AGMkodUDF3ED9RLd9ZDPrW9S3S/wntDFiHuZIVzpXxhZljsAw6j7VOlT82zt/ 8K88QBUTgy/t915aLowLF1AaCb4YzIdROhRM6M9wNjw7zMyOVf7NXdFGwF6EPfuLoN8e 5/xeTOlk2cP/g9GgzJr4EbH5/u50ZjejPiJ1J/rx7btKY1TmpkIwSlkzIoLFhQMwzhwE FASg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:organization:from:references:cc:to:content-language :subject:user-agent:date:message-id:dkim-signature; bh=VqH7ktciVqAaOQoQCTYhPrVVtI3DtT4Dryb3Pgh3TtI=; b=WEHpSj74pYVFqSjrfwUmA74lqchHNcCKJrBTy0Scspu7He4A+I4ergNaojiY1UvkAp 1OmUSuOpvGtaAd47CmBn6ChlY86cK+d0W3VUXwQAzEm2xDXbTh4UdV/CH37xprhcA1Xl 0xGml9FpH+bWfnTRp+lzqPDFSRua1P9nZo7Wqeg7PvJw2WRKW7o3hNVq+h4JDscG6zNU 6ULrFO2fyS0MV8YvVl+s5UJUG+mmSQrULhgCL+WqNucdRhAgvMqFPO7AUlBgENUJSYsu yNGCVbI5sAn1VNK1NBvZmgxtD3/j2k3yTckgpJUIlIOCfoZs8QmIlaIiErhTMTn1VxUG +a1Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="Cgnog/zY"; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f23-20020a63e317000000b0046eb0e3b1a0si7583456pgh.146.2022.10.26.13.44.07; Wed, 26 Oct 2022 13:44:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="Cgnog/zY"; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234432AbiJZUhz (ORCPT + 99 others); Wed, 26 Oct 2022 16:37:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233343AbiJZUhx (ORCPT ); Wed, 26 Oct 2022 16:37:53 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2079.outbound.protection.outlook.com [40.107.212.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41EFFE4C06 for ; Wed, 26 Oct 2022 13:37:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JK0AzdV1QwL/GUgZ/gkybMN8KdWHvNwDOCA22MFUK3OcxQVt0oulyjM67peflQPpYyq6kDbMdR+Og7tUQ4wzePmIzY98egcWnrhMCa4rGSqTvXprr5mco9osQuJSAk93L6e8mEM24PEskfJNXVJNLA2KERtKvs8MykmIFOdoysRwJKyZwcjrKylY8OPBYEric2OByqW8vhQh4pMsRtQWfp++uvU3EJSEpOahTQzUXluhqld3OiBKuifSVgtdhMbe2rPglZMeZK3RAmRyaRQyuZylUMBn+ObNHC50inTCYmCDH/9JI2ekL3KjJHbSrh/ea/FH1UPrPTYPl2J0HVOBnA== 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=VqH7ktciVqAaOQoQCTYhPrVVtI3DtT4Dryb3Pgh3TtI=; b=kNOPMbV3YTkUijM27AwXnkRfHUB5lAmRsPThrLjBkEfkrEcSgj/VAB+8P5OQUqDOJIEs6bY1RfyQiMeLJY4CX68/tUOC/0A6oFKceha6rvc9d7ztTgnXbEEW3kYftQmLN02bukJuiuPrZSHtBOQWbzHcBZlfein5sCtKWaOUQRDIxlAa0giQuJGwDn5lnl4lNAkPgQ8eKqC87WexTlBsfTL/kE1IhthwxQYukH1+mHAUuEzhcqCOM/yS+JGc04TPwllAU92wMnz6Yj6DgQfwuDhc6yeRqz93JVQ2CqXhSj2N/PU3TM0eHl2vpA3ndA83Tp+ZK2kDPT8TDiloD4jA4g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VqH7ktciVqAaOQoQCTYhPrVVtI3DtT4Dryb3Pgh3TtI=; b=Cgnog/zYBvLJmoj95EmQtagPU3P/fFDTMRKpLhTMIDxeZnV42nLjkCT05KS5b3T+f85jUfaix2fWXYYNOf31d0qgnayPpW12Rp3YAFZXEAygbWNieOCIUlj7udaLivaBsdLeY/kaN4te/lqk+v1aTs68QlNuCarTJNpkni/OTmY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BN9PR12MB5115.namprd12.prod.outlook.com (2603:10b6:408:118::14) by SJ1PR12MB6025.namprd12.prod.outlook.com (2603:10b6:a03:48c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.34; Wed, 26 Oct 2022 20:37:49 +0000 Received: from BN9PR12MB5115.namprd12.prod.outlook.com ([fe80::7e91:f457:9ec5:33be]) by BN9PR12MB5115.namprd12.prod.outlook.com ([fe80::7e91:f457:9ec5:33be%6]) with mapi id 15.20.5746.026; Wed, 26 Oct 2022 20:37:49 +0000 Message-ID: <010a38ff-591b-b1b7-8f81-0b580a41b69e@amd.com> Date: Wed, 26 Oct 2022 16:37:47 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH -next] drm/amdkfd: Fix NULL pointer dereference in svm_migrate_to_ram() Content-Language: en-US To: Yang Li , alexander.deucher@amd.com Cc: christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Abaci Robot References: <20221026020054.57114-1-yang.lee@linux.alibaba.com> From: Felix Kuehling Organization: AMD Inc. In-Reply-To: <20221026020054.57114-1-yang.lee@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: CH0PR03CA0075.namprd03.prod.outlook.com (2603:10b6:610:cc::20) To BN9PR12MB5115.namprd12.prod.outlook.com (2603:10b6:408:118::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN9PR12MB5115:EE_|SJ1PR12MB6025:EE_ X-MS-Office365-Filtering-Correlation-Id: b4f511aa-57fe-45b8-91b2-08dab791f262 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nCblU3h1L8TAq2AovpcfExxI3YoqT5AwPQvSjwZKv5apmmF40T+2Suj6ge+VKW3IXGr65meczKKYf5xB8Ct3hdj1Ai9yz2bIwqD5rOAmI9dd7E99UGm1uvdTgnl205gOGfLknQ3s3mjwGiEqXQyKSB/X1M0Y7KFoolbHvyxuCVg9LB+dk1Uk36yqOPjS096OoSqRe+nWyGh/KSqyBjCdOlDPehz6K6vwYKUnGti4IYW+KWaJxv9nGVYpLGuZcPMknWA8w9Flky+oAF0NjkRlKmozTyefWpHIFy0DmP3ju/1VwJabUfF6tbeO3kbYimgQ0DwR6FHo3Ft4qdmEcEXoZvnWyPaoCvvxEHa9adnVbRMpGa7BDAlBm6mvT1JGWk6q8UTZ/7C8Ens1ga39ApIHkqtyrP1+9hoa+1uSoagKz8fKAJ1IweSt0rt9hpSFaxRFa69CNMCNoPbMOnbinn5y3mkge6EI+hhEL9xl4iw5h1bdANkvF8kn72a8TfEckEL3/jJfphDgc34w/Y5xIHYd0xEGwVoOY2MRf455hi/yBtEQiWbel5pJhd1NO8aJyZzbUJqRpbFjiM6Lr7z0z8v9SJS0KQVcQVZSzmZPXOSvKiAIPJrihUqV8HaWtzFfuTO2oWxCO1sJLJG+Hel2airFxs3FgZI91Gfp4ntBnsXfdgbYVuwdP+7StMOLUGJJ+dRj7IBywf75Pp3867Xa5OalOY4vZeZ443Pg2Rjgv6S5PRzLp/bD6WFuOnUZYYkg3YXK8Sfwwan11ZZvX6UUdLCnMl+gnxSb6A8uD2JbDaxnmfuhIoHCgyqgwJDhTOZNHcP6FrhZeT6JUVeQlqoXnoFyYQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR12MB5115.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(396003)(346002)(136003)(39860400002)(366004)(451199015)(66556008)(66476007)(4326008)(6636002)(66946007)(36916002)(41300700001)(26005)(6512007)(38100700002)(44832011)(31696002)(186003)(86362001)(316002)(478600001)(53546011)(2906002)(8676002)(31686004)(83380400001)(8936002)(6506007)(4001150100001)(2616005)(6486002)(5660300002)(36756003)(966005)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UVRuc1Y5VlJ0WU9LOWZYR2dHUDdqKzFFVVZkazdVVHh3T0ZCWnhGeFV1R1Q0?= =?utf-8?B?ckN6THdVRWg1TXdLMzUyb0NqSm45cjVhT0F3ZWJPelZRZVpaRFBMOVlFcHM1?= =?utf-8?B?QURWbHN4cXh4eHVWSTlXb1ViZUpiRTArMWgvY3ZaUlhMR2hSM0owVkZPUjQw?= =?utf-8?B?RjhrcXRnb2ZyMXJYcEF0eUVxK2k4VmhPTmNuOWJsUEV6V0wvbmJGenRzSy8v?= =?utf-8?B?WTR1Zlc3UElxRG4xZUZ5a3pKNzJVMEJFLzB3MEpnck1lN2lVUTJnQ2hQRFdX?= =?utf-8?B?V092M0xFZ003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=?utf-8?Q?fQTQRkW+HhIAVobqdHalZbeom?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: b4f511aa-57fe-45b8-91b2-08dab791f262 X-MS-Exchange-CrossTenant-AuthSource: BN9PR12MB5115.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2022 20:37:49.2595 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: W6TgBCz49NTiSMrt2uS0xxkm+o5SGNVz7lTgm7uoHAIVk0RuqEZ4fB/nM7aIvYThIvnKV95v96fIOVoy7R+Gmw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6025 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-10-25 22:00, Yang Li wrote: > ./drivers/gpu/drm/amd/amdkfd/kfd_migrate.c:985:58-62: ERROR: p is NULL but dereferenced. > > Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=2549 > Reported-by: Abaci Robot > Signed-off-by: Yang Li The patch is Reviewed-by: Felix Kuehling I applied to our amd-staging-drm-next branch. Thanks,   Felix > --- > > change in v2: > According to Felix's suggestion, move the pr_debug up before the kfd_unref_process > call. > > drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c > index 20d6b2578927..b9c8d29d95aa 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c > @@ -978,12 +978,10 @@ static vm_fault_t svm_migrate_to_ram(struct vm_fault *vmf) > out_unlock_svms: > mutex_unlock(&p->svms.lock); > out_unref_process: > + pr_debug("CPU fault svms 0x%p address 0x%lx done\n", &p->svms, addr); > kfd_unref_process(p); > out_mmput: > mmput(mm); > - > - pr_debug("CPU fault svms 0x%p address 0x%lx done\n", &p->svms, addr); > - > return r ? VM_FAULT_SIGBUS : 0; > } >