Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3910139rdb; Thu, 14 Sep 2023 06:33:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH//ru7raFBp7qMaVjDv86ssLJYGgG3ALSFSe3WyLOyy1OQza9XUUcyaPJz/2mfxXdSAun8 X-Received: by 2002:a05:6358:724c:b0:134:d030:e5da with SMTP id i12-20020a056358724c00b00134d030e5damr6366479rwa.21.1694698424190; Thu, 14 Sep 2023 06:33:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694698424; cv=pass; d=google.com; s=arc-20160816; b=OEvRYUkG1F3cNhBL5ZgIkKaekUl3thnivCQ2QafDn6MOmVrOQ0/D457RYOahRrra7x sbJTYmLtTdk/6bi6KBQ4o1tWbFfGhqsW4o3LEb5atmIj69S98ctbRKm8p8Zsc370uPmO dlnrPVN9E4ZNFa/sYAgyCpfQ4exAFZxfCZS6TRHZ0eMh8SDCfUcgD6ro2QGiFcR+UFQy OUWOViWH96EiryMkVlEXDMPjqLufKSLSW1YQGMqP8OEcWCc3YOQ+OULlT4/XXZdG9IQF 94Y48BSDL6srMALAz1rFpzebW4S+mnJleInaxIcqpsh5ES+5llsGcF7g5HqD2xjmF4hO KLyw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :msip_labels:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=9Sn3Ps9X7z1eS6nV7r9qkfMK7Blkuaz6gTPh1D/6zZw=; fh=Kg30bH7F5SHhgzw58WxMdItmmozoQ4pyRlYZIu34xsg=; b=HibuscS/JmLJFzCkLBrFahiDvZCOx4uxgiHYd9ZWX7bigEAyUKk+3ZToJ7JP+35a5d srOQRVt2GKP21+baEZAEW2Ruc60gJ71TFYhvSmVOeACyTwPF1zYLp95pYFky6zVd4fET ilzwhpvY1Kh6Cf1OXcHjzXciBM97+z99PIVEJo4iAGN46QUx5TdSAdz7YxPTP5UBvmd7 WyzHTOapgoF+SgdhaTRV7OCCMxsM8na8p3/YlfinkbJQqwWFrLP66kWyQlUEZ8lK6Cyl ON2qE9eKQgnlmYvjwzZaZOhOVqhCAIMmAJCaCkbJ3BFP3hJDEZwEzg2JhqpV3CmmFh2R JKSw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=To3TalDU; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id d26-20020a63735a000000b0057745d87b4csi1507415pgn.526.2023.09.14.06.33.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 06:33:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=To3TalDU; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 5524E826EEA6; Thu, 14 Sep 2023 02:53:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231668AbjINJxj (ORCPT + 99 others); Thu, 14 Sep 2023 05:53:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237316AbjINJxf (ORCPT ); Thu, 14 Sep 2023 05:53:35 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2077.outbound.protection.outlook.com [40.107.243.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C80C683 for ; Thu, 14 Sep 2023 02:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OMVvQ0qkcDAA8n897Awetg3joNrCQoJHjZzBPwn6FZauTMYab/y0zbEU9+72VhEUhcD8hskMe0H8FUPrd3xXRfDW5fkF4aeMicTvgzJButUCi9+prPotTQGGRUfTSInIy6MdBWg4B1eBE7lbE0K1XsbQN0wls8h7ZTNWfL3fRGP70A0XaREKTZgsYb1Do5biHwwNIBq4td11+lFSHRpTN2eZwbxUzR02hKExIjJSWTX6jbbE4cSAsbjM+1xkP7LqMDmuTm0oHn3j4VIKebV74jHxszsXFVfWPYw+jbOA+wY6YCXcbx95YSx+61zLTEqTy8JETpBwh77yd7AXAoNWkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9Sn3Ps9X7z1eS6nV7r9qkfMK7Blkuaz6gTPh1D/6zZw=; b=CDnz9NYnRBfc4n3VpT9gwHlbNhSitj0m6HC7p7s82yTwJAIv2/b4ukuNT67gqjTNr4g5SG+QcbpD+mqv6kFI2WEYhdPQE0HoyQjzUk3vf4mmLfkKxMmu91USsHJ2YqxeLn8CVMErjVcBBNEsiO/5KgqXYejETNNfyI8g7pRUsuu2uu2tocQnzxW5Z9nadSfbw4Phff0bMGGz6ybWXuNb1BWSM7AlvaZ3/cVdyUdzA0kOvya++bZdMHEEORq2uQgOBgkFGr4TnTHgz52XoLsLsn66aJtKhuhh3abA1FhaSW2agz3id1PDh8kAmj8C9cninuk8ODuwOxNmfQ/TctwskQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9Sn3Ps9X7z1eS6nV7r9qkfMK7Blkuaz6gTPh1D/6zZw=; b=To3TalDUr7lw255oQOF1V2t2OjEjPRK/hneMs5soCSiZwvCw7Ls9xjPvkeaIkFSv7Yw7QcQJraHSSPQ1uRe3ZrxdPzWr1q13+crqBuKPGC5k9UOV7AT5I53SmyxIirPGK1XIU+X1FK+AP5xKGZphqkU1WUDTXYdC5z2WZCkc5ms= Received: from BN9PR12MB5257.namprd12.prod.outlook.com (2603:10b6:408:11e::16) by SN7PR12MB8818.namprd12.prod.outlook.com (2603:10b6:806:34b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20; Thu, 14 Sep 2023 09:53:29 +0000 Received: from BN9PR12MB5257.namprd12.prod.outlook.com ([fe80::186c:dd6c:34f0:5632]) by BN9PR12MB5257.namprd12.prod.outlook.com ([fe80::186c:dd6c:34f0:5632%6]) with mapi id 15.20.6792.019; Thu, 14 Sep 2023 09:53:29 +0000 From: "Zhang, Hawking" To: Cong Liu , "Deucher, Alexander" , "Koenig, Christian" , "Pan, Xinhui" , David Airlie , Daniel Vetter , "Yang, Stanley" CC: "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] fix a memory leak in amdgpu_ras_feature_enable Thread-Topic: [PATCH] fix a memory leak in amdgpu_ras_feature_enable Thread-Index: AQHZ5vBjNnY649fsxkyGyJQYBJiMbbAaFKdw Date: Thu, 14 Sep 2023 09:53:29 +0000 Message-ID: References: <20230914094533.213548-1-liucong2@kylinos.cn> In-Reply-To: <20230914094533.213548-1-liucong2@kylinos.cn> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=c61b1444-a713-4f4b-a750-efac169591ff;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-09-14T09:53:09Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BN9PR12MB5257:EE_|SN7PR12MB8818:EE_ x-ms-office365-filtering-correlation-id: 35b59347-8934-48c8-7de7-08dbb50872a6 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: PppgtTlYwEw4GXQQwxDxt8cs+Le/SFsN/fF6tpBEMtddRj3/f3kepsX6QIntBpSeOpS9DcENRoc/HCosG/kSSGXj+HfLmyWM/vlG53BS3gfFsX3kC3om3WIi/+b+bJyQssersTLVbQZadcvxTOMPImwoaPVppJMUgWpRdWJEHECr+G13+nQ9fPFGIg8o4FCmHUTQWTZhh2JoThworHqb8sRm6kIX4M+Lr8osdj8/BPZiC7vuPwLiiGl9Phi9Ol/IciUHHZmQ65ZrJ6k+SPDsdJuwJhfJQpFulin96JnHUDHScaMhwTvzlNcWNdIQn4YRGpSZP+PdYMzj2jnPRyO3Ihp1Mzmf0OrjSrOrpwf523Dn5kwKsNQlXWTYPNmweOnILKQ6D+tFJxjHwZk58RAv6KX4cij9ipw+7YjfWhRLFJC3/4F60Z0LPsWN1RSdmW/lRWyeOj69Yzdrfx+G8bxGn7DkcxPZ9wDeU0IPcDyxJApzp7XzuwHHKeVDYw+oL+ZiqAd1Fc9UCdrQ/67gNIdXqgtRc5WV+OzYjj424e3CibpF9BkRZc4K0AsO9esGPi45xnjUKnwBh8TvjKW3Eo+yv4UWFqcwvvUPUjnw2FLWVZWAzE/+QjYR80NeX9nR7/6xORmySMGx0pDer1WHj3Z5mw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR12MB5257.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(366004)(376002)(346002)(396003)(136003)(186009)(1800799009)(451199024)(2906002)(86362001)(9686003)(53546011)(33656002)(26005)(478600001)(6506007)(71200400001)(7696005)(83380400001)(38070700005)(38100700002)(921005)(122000001)(55016003)(41300700001)(52536014)(8936002)(4326008)(8676002)(5660300002)(76116006)(66946007)(64756008)(66446008)(66556008)(66476007)(54906003)(6636002)(316002)(110136005);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?qek+w2rl7N61SGN76eZ6RaHW2i/MOnZYJvqkFTirCqwE+95hOdyvWc3/eRUT?= =?us-ascii?Q?fNtxVBrgU+VpaJ4CGKKUxjlsuStmNZ8xCQVemz0VgIUsjZf+7bGF9oQyeH32?= =?us-ascii?Q?nQjAPxPpJ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eIcW8nIFUqcE?= =?us-ascii?Q?YP+1rEDhlVirT2bjJ4U9j5lx2xxc7ymbJMiw27EusoDx5Ge9kciRvAwBtYYx?= =?us-ascii?Q?sbHL7MbIiI2Ipsc2/py7uJ8K7ackEKkJZDqZ4VORWCGnMJ7+8s36d5Rmngdx?= =?us-ascii?Q?w0blBRV9k3Ti1cyxOlkdzEDokgw9DRQ6dUNU38uqP7wgt7S2ix4f1A651N6G?= =?us-ascii?Q?TXI0tPKYPXej8rStN9QNgcaOE5WDiiIgAirS1chzF7de2Sdr/yrqqJGRtGAn?= =?us-ascii?Q?2a0O4uvtBtnHiPIqR3nyE7IYqjyAngNh+47x1duSJw7pmj5l0TEaj7sOW6TS?= =?us-ascii?Q?NJovjdlFwb9c3yZ+GHFb+f0MGmDgcJX1DzgA1HAv1UbFGbOhKBbkakmOvecI?= =?us-ascii?Q?AUYSqb7bEWNQEO8ugnU7BeRsitYZ7BeyO3WuYDO5Nxd+nNsNVG5hW+YEkx/5?= =?us-ascii?Q?ACR4QD/eZaCZJdaUd6Qfub660kxldJD06fiWIaCK1cpiHiTArsluy/oZNKK9?= =?us-ascii?Q?noWCDwc/Twg+2Jd5k/tWxq3dswCx/PoR9Iw0T3AQH80NM7X/44gSQSzkbjAv?= =?us-ascii?Q?wiWyyJymYVlpppY+16w=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR12MB5257.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35b59347-8934-48c8-7de7-08dbb50872a6 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Sep 2023 09:53:29.0389 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: p5OWu5VZfwqlOwnddxUkJWQtGsjRflMdP9TgwqlaijSzauMCWUJYYIF/Jn62TJYjlHvCOPG53nwfjYyZDtCqKg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8818 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 (morse.vger.email [0.0.0.0]); Thu, 14 Sep 2023 02:53:43 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email [AMD Official Use Only - General] Reviewed-by: Hawking Zhang Regards, Hawking -----Original Message----- From: Cong Liu Sent: Thursday, September 14, 2023 17:46 To: Deucher, Alexander ; Koenig, Christian ; Pan, Xinhui ; David Airlie ; Daniel Vetter ; Yang, Stanley ; Zhang, Hawking Cc: Cong Liu ; amd-gfx@lists.freedesktop.org; dri-deve= l@lists.freedesktop.org; linux-kernel@vger.kernel.org Subject: [PATCH] fix a memory leak in amdgpu_ras_feature_enable 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 *ade= v, enable ? "enable":"disable", get_ras_block_str(head), amdgpu_ras_is_poison_mode_supported(adev), = ret); + kfree(info); return ret; } -- 2.34.1