Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3804041rdb; Thu, 14 Sep 2023 03:14:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFMpIkap2lI+dCh7YicMd22lagUcgc3MSfjhpBLu2X75CgYcqJswHi8g4p6eS7rTYue4S7f X-Received: by 2002:a05:6a00:14d4:b0:68f:e0f0:85f4 with SMTP id w20-20020a056a0014d400b0068fe0f085f4mr5661298pfu.25.1694686460041; Thu, 14 Sep 2023 03:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694686460; cv=none; d=google.com; s=arc-20160816; b=J48oDUNCyAm824bItFdO8Dt+DXjjeYrX/BCTP0pngetSaaHkxHWDHKC4u6AB/2x+pZ cZSqKcX8sQbTvW9bYqPMbq/zj44u0NQtxDAXQecIWONH4RBoZDaPhaxMSZWGw4OdiUzA N/+UTRLLQBoFv7I5iDA9mv/w2yIK7KTKjD8iOsZCcxvoqNlwimJDDbGI75v1At7xfQyw Fc0sWJUNZZh5ThSGWh66JXQhfVFa09LmFMwWqLghFnJb38/7rEI5fiFmO6fW11YQf7Rd pO+Te8bEcLwIKRjazruxPWetEugvSnkGHpQNh5duIPGedxs0FhqLSWQ8Curq2xa0JnYN UtqA== 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 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id bt8-20020a632908000000b0057744d09d2fsi1218997pgb.18.2023.09.14.03.14.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 03:14:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 97D64804C1AD; Thu, 14 Sep 2023 02:46:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237374AbjINJqq (ORCPT + 99 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=20K=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 Content-Transfer-Encoding: 8bit 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 (lipwig.vger.email [0.0.0.0]); Thu, 14 Sep 2023 02:46:50 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 --- 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; } -- 2.34.1