Message ID | 20221026020054.57114-1-yang.lee@linux.alibaba.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp6094wru; Tue, 25 Oct 2022 19:07:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7H4bfz9tFWS5zxIq9oXksrf9W1lroogEsC/QSsXb1ILT9KCpwN2jTxvsTB1g3No4qAc95F X-Received: by 2002:a17:902:c407:b0:17f:8bec:e7f4 with SMTP id k7-20020a170902c40700b0017f8bece7f4mr41396096plk.156.1666750026035; Tue, 25 Oct 2022 19:07:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666750026; cv=none; d=google.com; s=arc-20160816; b=M8F8QnF9l/2jcbLBXIG6s24M01JEPJsFNC0NW61zzwJ/VlhwmkVOahSDUBMdDhJUc9 w48SezZ9tdcoav6VaZcAuG3Yb6/ZfeDUieZAgIxNp+SJjoW7RZHOiBOOX1fVeuiayFxN GZ4mlBQlLJK+ERaWWNk48YnuKp/1/qWCBKRUm6LdoO+UUWW5/kjGBzI2hdnBvUP3+Qh5 T2wyhLmv63TbfuBQrDG57fEtEZTKefgJH0JT8Ay7bPFL7ah4vHkdPkQD7PuXLr23Vobh dlsEVoaLt4GuyqDRxWN82i1t2aCL2bmwCLcVUz7U1Eh9Nym7KtWefvueLYvaKfO9arZH 85Bg== 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 :message-id:date:subject:cc:to:from; bh=kp7aeD8ejtZZ72C/ddEOJcA3L7m7lkcetP61eU6N5wE=; b=i0Y7VqBfmWU7uqd9zV9B2p0l/6mVTlxI+Cipt0jenrNXGzhFNFUgJnCjksGvJPZq0p MnNtV+xiCAUnZ8Ep5Z9OrCRU74t+PVd+aZ3bOPfrFu8Sbc+51nxsvYdFmCcWVq3Vkf+y impfXBI3+So9yGioFQ56k90jZ8grHDuEmqhOm1x+M6CaXJQu2G9+nvV2f6A6bbxEhfD8 k1mvEpRtQm5aO4ojkFRsB6+deLB+tt6UJkn7GU/vVNIA97QnEW7I+eIpK6dH5xtvHpBV tBK2fY8RNyAZnBwTNHdQ/E0jANCp5yVhKxEt7OPqRhX/D40zdbuiEaP9/fV0PMh99IRl gBUQ== ARC-Authentication-Results: i=1; mx.google.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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x26-20020a63b21a000000b0044f2a51ef3fsi5820882pge.687.2022.10.25.19.06.51; Tue, 25 Oct 2022 19:07:06 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232698AbiJZCBF (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Tue, 25 Oct 2022 22:01:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232671AbiJZCBC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 25 Oct 2022 22:01:02 -0400 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CDC26A507 for <linux-kernel@vger.kernel.org>; Tue, 25 Oct 2022 19:00:59 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046060;MF=yang.lee@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0VT500yh_1666749656; Received: from localhost(mailfrom:yang.lee@linux.alibaba.com fp:SMTPD_---0VT500yh_1666749656) by smtp.aliyun-inc.com; Wed, 26 Oct 2022 10:00:57 +0800 From: Yang Li <yang.lee@linux.alibaba.com> To: Felix.Kuehling@amd.com, 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, Yang Li <yang.lee@linux.alibaba.com>, Abaci Robot <abaci@linux.alibaba.com> Subject: [PATCH -next] drm/amdkfd: Fix NULL pointer dereference in svm_migrate_to_ram() Date: Wed, 26 Oct 2022 10:00:54 +0800 Message-Id: <20221026020054.57114-1-yang.lee@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED,USER_IN_DEF_SPF_WL 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747714075025055936?= X-GMAIL-MSGID: =?utf-8?q?1747714075025055936?= |
Series |
[-next] drm/amdkfd: Fix NULL pointer dereference in svm_migrate_to_ram()
|
|
Commit Message
Yang Li
Oct. 26, 2022, 2 a.m. UTC
./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 <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
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(-)
Comments
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 <abaci@linux.alibaba.com> > Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> The patch is Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> 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; > } >
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; }