Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4330259rdb; Thu, 14 Sep 2023 21:07:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFfYgYMQpyIRh9hQ7m9cYRNodvuklK3buz0Rfj3shv8jeSV4WncoQuBrH0/LiEDYF7qDdhJ X-Received: by 2002:a17:902:e5c2:b0:1bd:d911:2a85 with SMTP id u2-20020a170902e5c200b001bdd9112a85mr612467plf.12.1694750858453; Thu, 14 Sep 2023 21:07:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694750858; cv=none; d=google.com; s=arc-20160816; b=iuHUkji3x5j2xtBB5D2TzDffypCe6bj0lf5tS6agOmd8k9Dx3tVJGFhVSWeCdpAFm2 oCSBoeV1IgWy2bvBHDIH3N+jFr+Bmrf4OI/mslggucwwbAkBqMduA/EOZbNqP/zyTn3L 0pfvn90TcXgGuTdE7tBhM9IpF6cSdwzaNuWwmb/qmjUKRN0DDG5FInxuGsByVYq4bsDB cf2/tmn6W00MKl44RHjT7Dsh39Fql9l+WEdVZ2uTPWzAogP5jRCTwSrDfhPBbEXuCaQ5 mx942m9inG6qe8je2EFmdDho+VGBgap0+UiK+BgFd1Fo1IcAKZ1fwBqxWDYaaz1IXB5N 2//A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=lYFkx59s2xs5GUhtqs0B2NG56CjyPAmSZL2SFzjSb1A=; fh=rimcG74i7tK7DnlyBiZOEUG2xzmBU/MkSyODYItjnRs=; b=IAwWVJEtWKBRnDz2a9NvmvA6Lax7/JLillwsipG4ko0lwqe8So+WcMZbNqE0s9CIss Gc++RtJMbVuWZlzyJj+XC/+VGqxeN0VTVtqO/u0nMH5C/DG8HUxmeXJDSxir2OmAg0Np BL2dAIoUD60Aebkn4zOqopz85nJS4QaO3Suys90YHStlH5y05nTp10bMq6H4nZnFNCFC lCwaiIUbrgDI88l08vVWbAGZemqKCz2KbMr18tJbQAdPezbkggnw8HjPPXDX8giNf7IL e/H+3JDaMnSWjSDdkBmvc3wlteu35TeSSoOQX/DXYSqv27+gIIhcw7KhccimOS6j+ogd zLOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=W18YskAv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id p12-20020a170902c70c00b001b8b7460620si2637066plp.181.2023.09.14.21.07.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 21:07:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=W18YskAv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 6DA2B82A39A2; Thu, 14 Sep 2023 13:45:38 -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 S229623AbjINUpk (ORCPT + 99 others); Thu, 14 Sep 2023 16:45:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbjINUpj (ORCPT ); Thu, 14 Sep 2023 16:45:39 -0400 Received: from mail-oo1-xc2c.google.com (mail-oo1-xc2c.google.com [IPv6:2607:f8b0:4864:20::c2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7FD32120 for ; Thu, 14 Sep 2023 13:45:35 -0700 (PDT) Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-5734f54dc44so797467eaf.2 for ; Thu, 14 Sep 2023 13:45:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694724335; x=1695329135; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lYFkx59s2xs5GUhtqs0B2NG56CjyPAmSZL2SFzjSb1A=; b=W18YskAvzb69o+UD1NsNXlpUCA99U/LyMniG/sAUQ0DjEHvN8NE9hQAnnEDVRHAMfm N+B/fifc0k5H5AjbSX/owFBpfab3Hyp6h1ecUrNHQPRunknFGwuHQpXT2hzmdjiyEH91 foqsP1AxTgYSEGa1pQh/hVM3d/6x+HAvcyKYvCcU0uiyXbxutloPHlLude4e0OC/hMCv 4EH9RxcquG8AjjebWOXU9hKAOfv1KLPwUpCUWgcTqatR5CbNC3/Jv0mj1/v7nHUndmIj KqeBr5fGpLVRjHZp9BhNfKJw5rnTKwVVA8t3BJJsD2xVvsB84w8trX65s4JGVaJomRiz Ke6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694724335; x=1695329135; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lYFkx59s2xs5GUhtqs0B2NG56CjyPAmSZL2SFzjSb1A=; b=CQevixNVsi5OP2g09V7IOGuVKLfNllTbzOCU1A8+FxeL/m223S1yueO7vrJU8o4JCj klU2xVkglWR6eZScM4PKPkqf8J6rjb/+EQmKCQe0M7dOZX6XktOrbLerNR4HDgPAr+A6 xuQ6CVt6eefiRxj6HCvfGfcwIhsRCz8C4NW+gEOYdtmLG2O8gH13rkA+kSLsS+KCnoFm lWleUUIfVLAb1JElvat398gakTSErgI589ndF0rthqzs1fL8seEFgrZJn/Aee6A1qXsW RSgy0u2DiE0XqviSsA51Z0KeFuQ2QyUDW6Iooy1o2W4U/9eVAKKQuFRkAJ3B5WAiJljD IUfA== X-Gm-Message-State: AOJu0YwHGD9Jbl7Pag4O3RkTgAtMXyPXKzQHENvqqK4i+VJL0cgcb3c3 cplBQ02BW/ZmF4NqAOLYXZKWk25cXCzNYtIPa/poSCEy X-Received: by 2002:a05:6870:3412:b0:1ad:5317:1f7d with SMTP id g18-20020a056870341200b001ad53171f7dmr6949318oah.39.1694724334982; Thu, 14 Sep 2023 13:45:34 -0700 (PDT) MIME-Version: 1.0 References: <20230914094533.213548-1-liucong2@kylinos.cn> In-Reply-To: From: Alex Deucher Date: Thu, 14 Sep 2023 16:45:23 -0400 Message-ID: Subject: Re: [PATCH] fix a memory leak in amdgpu_ras_feature_enable To: "Zhang, Hawking" Cc: Cong Liu , "Deucher, Alexander" , "Koenig, Christian" , "Pan, Xinhui" , David Airlie , Daniel Vetter , "Yang, Stanley" , "dri-devel@lists.freedesktop.org" , "amd-gfx@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 13:45:38 -0700 (PDT) Applied. Thanks! On Thu, Sep 14, 2023 at 5:53=E2=80=AFAM Zhang, Hawking wrote: > > [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-de= vel@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() functio= n. > The leak occurs when the function sends a command to the firmware to enab= le or disable a RAS feature for a GFX block. If the command fails, the kfre= e() 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/am= d/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 *a= dev, > enable ? "enable":"disable", > get_ras_block_str(head), > amdgpu_ras_is_poison_mode_supported(adev)= , ret); > + kfree(info); > return ret; > } > > -- > 2.34.1 >