Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4216710rdb; Mon, 11 Dec 2023 12:12:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IFTcm7QtXgLfBrk+WQ60XQ40qo3py/oD6u9Bo7oievEr3xl370EeAInn/oribxGGLMCQ6cm X-Received: by 2002:a17:902:d4c7:b0:1d2:f388:6dfa with SMTP id o7-20020a170902d4c700b001d2f3886dfamr5806817plg.30.1702325576058; Mon, 11 Dec 2023 12:12:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702325576; cv=pass; d=google.com; s=arc-20160816; b=vXklF+IRuNYfq4K5H13UntLe1KWHJweLp0m+Lnll3NfmJ4hskDfMe2imBLBFYXb9ir nPDQ5mouAp33VAm+mGlncmkmxnlg372Mkb9xyQBzaB5JJDbpIWJfdKuZAQjBoLnHw45k QIetG68zm3tX0EfzeD5uLnWv1bs81aaxwa8dqurqiUrH7l/5uBjQ7IdopqvagVRYXbMU 55co6hhDdTo9zGpLbVdvx3CusLE+WH98gpSyN4ZWH7DoCs3pLRNAzUWQhHJx1P3DH+IG J4W8SjKJWZG7Yc4zl6jukr3K/UMVoe6SCuklLRxS6gIxau5IpFC1nf2uFfx1u5z8tvCK /zjQ== 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 :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=YV6gzpPkV9jfagsTjyDjLHJKzMTseXESaqu/BC1BJ8w=; fh=Mm+mo1fVD4/BZsQdnkEE5hDdTIC7Xu0dguKSDecFVgE=; b=ygNr1d8k/z5lkF6Ws18hHsexqbib2ypg+nV5A0TvSVGHlg4ZVOMiXwE3/WRNO3dF+0 zv24MZ5eX8/utYzgYpe37kV1C4vykl/wvP0B3bAkgFKfTg25wJX7KzZCCTIueUz6eB0e bECdY8CUBiakXt97O6w0E7aiv7ElZ5Og/eQGD7RqBbcSbp4jeTROaiKid+bocDVHyF4+ 7N/iLHGuAP/yJZqXsgfdMu5Fmve5xEluTaCdiUB5Z8WCxarxVMBkfHfrcUXZOrFXlU14 75MHfI/gHYf1VnZ3q3CTCDsp4ZVoJ4n6B6WnCg6hqW2cGIcCW4W57EjiPG8EmfrVYxWt oTvw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=S+45fr21; 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:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id t18-20020a170902e85200b001d0b5954eb1si6576975plg.143.2023.12.11.12.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 12:12:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=S+45fr21; 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:7 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 snail.vger.email (Postfix) with ESMTP id D29C680A7775; Mon, 11 Dec 2023 12:12:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344816AbjLKUMn (ORCPT + 99 others); Mon, 11 Dec 2023 15:12:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbjLKUMl (ORCPT ); Mon, 11 Dec 2023 15:12:41 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2074.outbound.protection.outlook.com [40.107.94.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B093C4; Mon, 11 Dec 2023 12:12:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O/KN99QQq/ZeDpsr/rE7s3Qu6/PyguMQDYJ6gcAxj+fs6PmDKQiPDdqh/HRC2fG52/7cki2vDR7XN5id24IWI5/it0RTEA5cLe8ACemY9BspN77KtsdUQQxJpws2IDGuPhUGEEDknLsJjfWCanZh78hlKUInbYd/BlfdvwKC5duhRgINr0tE9nLVjvha2mP5X+sUzhsyYdBjOOcNQvIchMBCY6v3B/TqGSUTcMgJmEMbu9QJG1U0rGW55uT8E1w5prh10Rx/KCe0QEsZaLdM3ZNtlUtkSihXYCLNAv0uzmCxrZN7wQL5066IwSE9QTq5siIlmpv67aUqDHwN0hG99Q== 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=YV6gzpPkV9jfagsTjyDjLHJKzMTseXESaqu/BC1BJ8w=; b=M0JHaXqglJNkX7oCIxHOk8qaEfNfqo2l/aO75rawxLbtqxX0LiUx6UqSoL3pFjcWPk6XcAlSyBHdyZIBviuBFrAxgBV1v196EDHzRY6xNxyUSkSG+IjHnGWCbJ6iN5DJdCo4f1TOMSXcd6moMGfhBx4nC8XWzd0l+0rL6Ktma07u7DF3AoRzRa5jtCjGvcCynz7s+xuzz9OgvofXR7qUN2jH/ouUDzMvn8iY7eSlWBMjSPbx559slQVZAuoM3yxP1DA+oT43oH4RpQChF3Mm+PNlosiKLENG5FPI2FDeoFBbXka17i9fC6veUppB7osaGgxKi7wD5ceP1K36f+Sz7Q== 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=YV6gzpPkV9jfagsTjyDjLHJKzMTseXESaqu/BC1BJ8w=; b=S+45fr21S43pLSJVR82CcjoYs+UfQCM0/SwurPSXLcqx0n0Yn3Wl8h/xBoq8KYYwBCFinCj1RmR5DD7Svtt8LOZUi6yra56OHQxmbvWLQ+sJCmHQ+n0a9IzNaZ1tpl6+nJSUUorFdhVGhK8LfM3Bhc6qrqnWZr+OfJ2rgYIkmjM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from SA3PR12MB8802.namprd12.prod.outlook.com (2603:10b6:806:312::14) by MW4PR12MB6754.namprd12.prod.outlook.com (2603:10b6:303:1eb::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 20:12:45 +0000 Received: from SA3PR12MB8802.namprd12.prod.outlook.com ([fe80::2881:460d:76e3:c2bd]) by SA3PR12MB8802.namprd12.prod.outlook.com ([fe80::2881:460d:76e3:c2bd%5]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 20:12:45 +0000 Message-ID: <04d3806d-7d45-4166-917d-7250a2f5456f@amd.com> Date: Mon, 11 Dec 2023 13:12:38 -0700 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drm/amd/display: Fix memory leak in dm_set_writeback() Content-Language: en-US To: Harshit Mogalapalli , Harry Wentland , Leo Li , Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , "David (ChunMing) Zhou" , David Airlie , Daniel Vetter , Sherry Yang , Greg Kroah-Hartman , Sasha Levin , Roman Li , Claudio Suarez , hongao , Aurabindo Pillai , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, error27@gmail.com, dan.carpenter@linaro.org References: <20231208095825.1291730-1-harshit.m.mogalapalli@oracle.com> From: Alex Hung In-Reply-To: <20231208095825.1291730-1-harshit.m.mogalapalli@oracle.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: YQXP288CA0001.CANP288.PROD.OUTLOOK.COM (2603:10b6:c00:41::23) To SA3PR12MB8802.namprd12.prod.outlook.com (2603:10b6:806:312::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA3PR12MB8802:EE_|MW4PR12MB6754:EE_ X-MS-Office365-Filtering-Correlation-Id: 071ac3c3-351c-426c-ad40-08dbfa8589a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CUcMhNH5z6Q+xq/DRvYI1GsptZpfTXj+5JU/V65/IxiRJk8Uaxl/xNoevuxcZxxzwUqC4ROXfJMsce71fSNlVAmiHfPIBCc48h5CVktRwEOT5B7HadeAbChUlrw5FHqmB8+U3FdO6JsylJqFuV3i2mIAKN5MXpTMWfX0dHvm0ysv4bABq1eDtqMBbBny47shevjGgA+lI8gHqlh41msyiJRXdhM0lRVyqElQe5WQvzsjSSNiFOc4C0UgndjLEKZZKeIJIpABKxz/0/AhVlKhHHaddnFdulYJd9pNgRzGCuua+S8oYIxbjG8IgBSa9vxMIRHL+UiF2aC05tnOkd3YR2Lun2LRvignTZ+nwg9eMM4kjMulT/oOM9Q9DdrFF0xpto9mjaIaX0yTfTV06Vpkr23MHxnghWsiKA9zbYj2NDHl5b1TuLB132yX1C3PfXULUAlcw3LGJS8QboaQOxdhnXmApGh+ZkwHWOocT66H5WrqmbDHZq5OGfCVdERODz25k1gt86ROYx89y9LK9mPB9u62xnVumzWJ3cYuoNJzSzdaMn14nREzUV5/IzcmaN8EFyr2Jad8Uus80EjhEctyqpift75aYZ1Cfr0L/SvxBoOB9oBtn9kCCaYg1u/s+PH4vXPCtHXY3aHKlUoXqYYnU/DbMT37FYLkm+xUL1NiiBI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA3PR12MB8802.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(346002)(396003)(39860400002)(376002)(136003)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(36756003)(53546011)(6506007)(478600001)(2906002)(6666004)(83380400001)(26005)(6512007)(2616005)(6486002)(4326008)(8936002)(8676002)(5660300002)(44832011)(7416002)(921008)(66946007)(110136005)(316002)(38100700002)(31696002)(31686004)(86362001)(66476007)(66556008)(41300700001)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZmI5SUh1cm1OM2NqcTVzbWFXdkNpWmtLQ3lvOHdLa0g5YkJBT1dzS0czQTJS?= =?utf-8?B?akZFNHBQUitsU1pGeUdWY2xJNE5JNEt0THJIVjlRaTNkdG1wNzNtL2MrVlFl?= =?utf-8?B?V1pTYXhRbnlOYUxCV2Rpb2pSQnBhSGZEZ1JCR04zQ3NsV2tGMlNFNkZOQmJv?= =?utf-8?B?Y3dWWThPYWdjWmZ1OURUTVY3blJqL3J4eGt1SjhPNDVsdTY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?clV1ZktUSUFQNFdtZTZYQjJJb0xDVGlYelcrTkRLR1JlYVVJMXJWc2JTZ0Vx?= =?utf-8?B?d2kyVG1IcWpSeEdhaEt4amVVZy9sRDhVL0Y1SUVnY0ZlODBSQldFejI1K1pu?= =?utf-8?Q?WiLaXQOICKcOYb2a8YqvAy11F?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 071ac3c3-351c-426c-ad40-08dbfa8589a7 X-MS-Exchange-CrossTenant-AuthSource: SA3PR12MB8802.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 20:12:45.1811 (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: pSQvuIEn5JBwgP2Gm+0hbL+vn3ctFVUD7Kirt2rCVijjN4s3hF1wbnYVWZCwy7AUSuFopJnYfcgsIVggC4j5lA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6754 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no 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: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 11 Dec 2023 12:12:55 -0800 (PST) Thanks for catching this. Reviewed-by: Alex Hung On 2023-12-08 02:58, Harshit Mogalapalli wrote: > 'wb_info' needs to be freed on error paths or it would leak the memory. > > Smatch pointed this out. > > Fixes: c81e13b929df ("drm/amd/display: Hande writeback request from userspace") > Signed-off-by: Harshit Mogalapalli > --- > This is based on static analysis and only compile tested > --- > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > index afdcc43ea06c..333995f70239 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > @@ -8871,12 +8871,14 @@ static void dm_set_writeback(struct amdgpu_display_manager *dm, > acrtc = to_amdgpu_crtc(wb_conn->encoder.crtc); > if (!acrtc) { > DRM_ERROR("no amdgpu_crtc found\n"); > + kfree(wb_info); > return; > } > > afb = to_amdgpu_framebuffer(new_con_state->writeback_job->fb); > if (!afb) { > DRM_ERROR("No amdgpu_framebuffer found\n"); > + kfree(wb_info); > return; > } >