From patchwork Thu Sep 14 09:45:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Liu X-Patchwork-Id: 139552 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp317578vqi; Thu, 14 Sep 2023 05:40:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHsAJ65JEQKFO7dc6kp7nV1c/Ous24znnZiZewLdy1bfMWbSDb3e+WkN7agAAZ3VqDPUVyy X-Received: by 2002:a17:902:e84e:b0:1bf:349f:b85c with SMTP id t14-20020a170902e84e00b001bf349fb85cmr6032472plg.1.1694695258205; Thu, 14 Sep 2023 05:40:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694695258; cv=none; d=google.com; s=arc-20160816; b=rJP8gvzjdT9KVg7s+AiDqcflOJryHBXYGdZTB2rpwpd7Ro64Hg+f6b0SKhAT1sbrh9 Z+u1+HS02qx/OfpyWVDiHszqnwPnO7BaArjTDZF8CB8AnWVxXKaJTGy3hId1XyF5K5rJ g/s9ml2No/lmzENiSP6mEcCL/Refd/ONdfURfWoSIn6pqHNBko30DYWc+hEvNXHd1mw6 Ppg3mDhDKQV8e5MC2e1JLfWzjEE2v9v8BUSJ9aqniRrKL+AL0F9i6QeasDpCTIogxwXM 3MeMeIzkfXLwLrvGrxUNGjTTcH+TDHoyXq/ps4FehBZjTnP4uS4BcQTAxgeJkh8bMz0c XeAw== 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=UcOTShK2yceUaIIPkq5r4vBuT2JiA5eVMEjSUBXeR4Y=; fh=ntLQBBe9AR7ipEODxNF/jDpWBpSnegjaVWUjIxds/DU=; b=JNyXNu+R80LLybFNHzklxjYUQ+7/M3lbx5KVpa3z9kqRVnsrtOR6kavE3Wm6Y/nQXo 4hKgO/mHZQ0PS1oZN2s25fYX0kW5f2KQ6B4mnSgGlTNVbPxK2gNFRoVNxBsR1chyfSN3 8S+F3OaT5eSMAcs3gk0VY1hZsLRh147c223VMw+w9IpPWLpTTNKbJ/CAiKbFDR31w2dq ui38I3o+DZg+IQ4cawGM9GUXcd4Z2HfmWJDuqZUt3x7rt6rL/dEonLAxEvO5K4a8g4Oy l6VEjgmcPXdsYjMu8KnAhbCNAM5MMT8p1NTBF8ZZGwZcUt1xMeGsVW8CHkd5oPrUD1zT nyFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id x10-20020a170902ec8a00b001bb42c27496si1695487plg.233.2023.09.14.05.40.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 05:40:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 473DA8087260; Thu, 14 Sep 2023 02:46:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237244AbjINJqq (ORCPT + 35 others); Thu, 14 Sep 2023 05:46:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237547AbjINJqS (ORCPT ); Thu, 14 Sep 2023 05:46:18 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67D86210C for ; Thu, 14 Sep 2023 02:46:12 -0700 (PDT) X-UUID: bebcfc2cd5234480a8d300e4f6e5c3b5-20230914 X-CID-O-RULE: Release_Ham X-CID-RULE: EDM_GE969F26 X-CID-O-INFO: VERSION:1.1.31,REQID:fd810b43-069c-4082-a0de-37e72278df8d,IP:10, URL:0,TC:0,Content:0,EDM:-25,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,AC TION:release,TS:-30 X-CID-INFO: VERSION:1.1.31,REQID:fd810b43-069c-4082-a0de-37e72278df8d,IP:10,UR L:0,TC:0,Content:0,EDM:-25,RT:0,SF:-15,FILE:0,BULK:0,RULE:EDM_GE969F26,ACT ION:release,TS:-30 X-CID-META: VersionHash:0ad78a4,CLOUDID:4256ef13-4929-4845-9571-38c601e9c3c9,B ulkID:230914174555IULG59O1,BulkQuantity:0,Recheck:0,SF:19|44|38|24|17|102, TC:nil,Content:0,EDM:1,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0, OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_AEC,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD, TF_CID_SPAM_FSI X-UUID: bebcfc2cd5234480a8d300e4f6e5c3b5-20230914 X-User: liucong2@kylinos.cn Received: from localhost.localdomain [(116.128.244.171)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1588511505; Thu, 14 Sep 2023 17:45:53 +0800 From: Cong Liu To: Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , Stanley Yang , Hawking Zhang Cc: Cong Liu , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] fix a memory leak in amdgpu_ras_feature_enable Date: Thu, 14 Sep 2023 17:45:33 +0800 Message-Id: <20230914094533.213548-1-liucong2@kylinos.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 14 Sep 2023 02:46:44 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777016775427391013 X-GMAIL-MSGID: 1777016775427391013 This patch fixes a memory leak in the amdgpu_ras_feature_enable() function. The leak occurs when the function sends a command to the firmware to enable or disable a RAS feature for a GFX block. If the command fails, the kfree() function is not called to free the info memory. Fixes: bf7aa8bea9cb ("drm/amdgpu: Free ras cmd input buffer properly") Signed-off-by: Cong Liu Reviewed-by: Hawking Zhang Signed-off-by: Cong Liu --- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c index 8eb6f6943778..b4a8ea946410 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c @@ -802,6 +802,7 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev, enable ? "enable":"disable", get_ras_block_str(head), amdgpu_ras_is_poison_mode_supported(adev), ret); + kfree(info); return ret; }