Message ID | 20221111074121.23296-1-arefev@swemel.ru |
---|---|
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 l7csp598679wru; Thu, 10 Nov 2022 23:42:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf42MZuq332Y7aRAC9AA32LE711Htv0k3dVEvUvA+2L+zyy7AbKIGWs1Rjhd9ANhx1+03gZV X-Received: by 2002:a17:902:e352:b0:17f:70c0:dc48 with SMTP id p18-20020a170902e35200b0017f70c0dc48mr1128848plc.79.1668152524706; Thu, 10 Nov 2022 23:42:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668152524; cv=none; d=google.com; s=arc-20160816; b=g3HuqYT6jHMgVWM0ZYAjno+cEENTcO8R/7LknE8oyu8FLIxVJzkE7Oqiocg8hNLnOn QSvxiHlFtNMWRthy0bU3HnRJsc8h2Rsd+F76ALyTs4c6ljUUejQ7gH+AIf5i0+0twU+j qGCWWx9kq7Cz7PAhkc3ARt4cUddyrJMpKc0UxmMvT1RZjoSQ/LMU50gHld7zAHrENOxb o7rKpG1+lzmgwmrP+n8J3NMXRmaeP3PbQuyZtfQpSu0qFt8CNDeII4SNx0o+WfVmHcV/ u4kNlNPi++6Svl4CV3/3BMswca/LuHF8xnOPxTygY069bpqGSOfFWS7K0M6qZ2UFr/ip n7Ow== 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:dkim-signature:from; bh=S0tk9zvEh9i3RpeDgKq2csbzg/78Ce7ScjSDjvtVy4w=; b=G17pA2mCF25yAn4nH1LP2YUVBd9T7eMDJGu7xIKA6Eq3Hpvx5i+G31hc9/dEuFolUM I7UbtUDKoleGe5hO5mxmBoGnvS5i47zTlvcC5oGBpdktC3HBXB190WvewJdGTYKgNfmi +XeuQyM+l88BLosXDPTbbDSiS5BU5V8hge+qmZ5ep97bBl1MeTgnq0A9UqjPLbkbOLCm AEjUfNhyr6XLmJU6I2Gaeu5qwtQlU3wWOFwNseNIt1uS/Aas9ZhtDe+GQfQwW+EVZ44C mmaLjgIPLscfDHDrll0pqVxWL8Md9amGtqIYGeqWBPykq3N5YavtvuUEtNbNrxMs2jn3 Y7vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=Zhddcina; 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=swemel.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d11-20020a170902854b00b001780ba6c694si1764516plo.35.2022.11.10.23.41.49; Thu, 10 Nov 2022 23:42:04 -0800 (PST) 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=@swemel.ru header.s=mail header.b=Zhddcina; 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=swemel.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232943AbiKKHl1 (ORCPT <rfc822;winker.wchi@gmail.com> + 99 others); Fri, 11 Nov 2022 02:41:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230198AbiKKHlY (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 11 Nov 2022 02:41:24 -0500 Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 203C1742FD for <linux-kernel@vger.kernel.org>; Thu, 10 Nov 2022 23:41:23 -0800 (PST) From: Denis Arefev <arefev@swemel.ru> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1668152481; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=S0tk9zvEh9i3RpeDgKq2csbzg/78Ce7ScjSDjvtVy4w=; b=Zhddcinakf6++7xApnMZ00jdePEv1cov2V1C+QqpTqjIFOM9JLXb5NcfnGH4hTJe8zCow5 bGI4g7sWqjFxa4zHnQmqWsFAgLQbXIa0c7xe+NIL/SyybXERyvAqI8Ph2r6/OsYGtpd83D BID1NE0t4XvProPDAQgl5w1Y5Sn05Bw= To: Alex Deucher <alexander.deucher@amd.com> Cc: =?utf-8?q?Christian_K=C3=B6nig?= <christian.koenig@amd.com>, avid Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] nbio_v7_4: Add pointer check Date: Fri, 11 Nov 2022 10:41:21 +0300 Message-Id: <20221111074121.23296-1-arefev@swemel.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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?1749184701366225991?= X-GMAIL-MSGID: =?utf-8?q?1749184701366225991?= |
Series |
nbio_v7_4: Add pointer check
|
|
Commit Message
Denis Arefev
Nov. 11, 2022, 7:41 a.m. UTC
Return value of a function 'amdgpu_ras_find_obj' is dereferenced
at nbio_v7_4.c:325 without checking for null
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c | 3 +++
1 file changed, 3 insertions(+)
Comments
[AMD Official Use Only - General] Hey, The patch does the right thing from coding principal perspective, but it is really redundant check in RAS context. The function is a hardware interrupt handler which is only triggered for specific RAS event. When software receives the interrupt, the pointer of RAS context must be valid one. Otherwise, even the interrupt won't be enabled at all... Regards, Hawking -----Original Message----- From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Denis Arefev Sent: Friday, November 11, 2022 15:41 To: Deucher, Alexander <Alexander.Deucher@amd.com> Cc: avid Airlie <airlied@linux.ie>; linux-kernel@vger.kernel.org; dri-devel@lists.freedesktop.org; amd-gfx@lists.freedesktop.org; Daniel Vetter <daniel@ffwll.ch>; Koenig, Christian <Christian.Koenig@amd.com> Subject: [PATCH] nbio_v7_4: Add pointer check Return value of a function 'amdgpu_ras_find_obj' is dereferenced at nbio_v7_4.c:325 without checking for null Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Denis Arefev <arefev@swemel.ru> --- drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c index eadc9526d33f..0f2ac99de864 100644 --- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c @@ -304,6 +304,9 @@ static void nbio_v7_4_handle_ras_controller_intr_no_bifring(struct amdgpu_device struct ras_err_data err_data = {0, 0, 0, NULL}; struct amdgpu_ras *ras = amdgpu_ras_get_context(adev); + if (!obj) + return; bif_doorbell_intr_cntl = RREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL); if (REG_GET_FIELD(bif_doorbell_intr_cntl, BIF_DOORBELL_INT_CNTL, RAS_CNTLR_INTERRUPT_STATUS)) { -- 2.25.1
diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c index eadc9526d33f..0f2ac99de864 100644 --- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c @@ -304,6 +304,9 @@ static void nbio_v7_4_handle_ras_controller_intr_no_bifring(struct amdgpu_device struct ras_err_data err_data = {0, 0, 0, NULL}; struct amdgpu_ras *ras = amdgpu_ras_get_context(adev); + if (!obj) + return; bif_doorbell_intr_cntl = RREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL); if (REG_GET_FIELD(bif_doorbell_intr_cntl, BIF_DOORBELL_INT_CNTL, RAS_CNTLR_INTERRUPT_STATUS)) {