From patchwork Tue Oct 25 07:28:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Li X-Patchwork-Id: 13018635 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 DAA6FC04A95 for ; Tue, 25 Oct 2022 07:28:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1AB0810E209; Tue, 25 Oct 2022 07:28:32 +0000 (UTC) Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id B46E8892E4; Tue, 25 Oct 2022 07:28:28 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R201e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018046059; MF=yang.lee@linux.alibaba.com; NM=1; PH=DS; RN=11; SR=0; TI=SMTPD_---0VT1uIFE_1666682903; Received: from localhost(mailfrom:yang.lee@linux.alibaba.com fp:SMTPD_---0VT1uIFE_1666682903) by smtp.aliyun-inc.com; Tue, 25 Oct 2022 15:28:24 +0800 From: Yang Li To: alexander.deucher@amd.com Subject: [PATCH -next] drm/amdkfd: Fix NULL pointer dereference in svm_migrate_to_ram() Date: Tue, 25 Oct 2022 15:28:22 +0800 Message-Id: <20221025072822.129940-1-yang.lee@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 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: Felix.Kuehling@amd.com, Xinhui.Pan@amd.com, Abaci Robot , linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, Yang Li , dri-devel@lists.freedesktop.org, christian.koenig@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" ./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 --- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c index cddf259875c0..405dd51521dc 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c @@ -981,7 +981,8 @@ static vm_fault_t svm_migrate_to_ram(struct vm_fault *vmf) out_mmput: mmput(mm); - pr_debug("CPU fault svms 0x%p address 0x%lx done\n", &p->svms, addr); + if (p) + pr_debug("CPU fault svms 0x%p address 0x%lx done\n", &p->svms, addr); return r ? VM_FAULT_SIGBUS : 0; }