Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3571953pxb; Mon, 24 Jan 2022 12:31:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+B8zitrOlwAExfJV2dNrJwdRS+ZKHVwlUnKKWHBZs5+XAjv0H4Cyhai44p2JsQ76wE8N7 X-Received: by 2002:a17:902:db05:b0:14a:8fda:e323 with SMTP id m5-20020a170902db0500b0014a8fdae323mr15788958plx.96.1643056271268; Mon, 24 Jan 2022 12:31:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056271; cv=none; d=google.com; s=arc-20160816; b=uHIfn8akQGEhBWEQN5S72nu9SYWCwLI0UhrhoxOrEiEEBq8HJV44254imwXJZeGDOL Sjze1c+3qbRiBR72v5C607KeA0CVCG8/nSg4eBB7PmTczLdMW4V9zK48/VUOlGHAzlJd 4ZwOt2/zxgd32SmXl4LrDxY5+Tm7ROWIe7C5/9RjENaJ1/YaZ/bFq91JHgScK/7ExBoC gtpAyTA0Ry6/4pCVljTQaAahE9sBB7x7dAoDNY3E2b4OQZL3QNZCNtqdehUkVmkgchvN vld9/VLbdk+YnkYq+ADyHHJvFbYV2EbjMp52kc9orQ+jRxciTXOkcj1Ysh07gWzRUuIJ TyjQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ICWv6oOcFKSNXyoAnbzOYhcSQRQXAsDADR/BWyPC6lQ=; b=LkSC0+DEyI97gGY7ZIJ4s8yVdreBVGOB7csh2ULRYZIBPKX1A0iKUe2zLU6jVKyB7r CcvdEV0wS2RkAIy1K+hx7Po/Vr0goWssSSueuD4aqOBws1ChFshjMY6DQIv5UmSdVXuF brAxIyuMgGb7/gYv1xySAKyvy5We0njzO9tbgxP66mxQrSwEl4tRFJasQBOvNKr9rDzD R6aLNXczgurWj+0MuOE7UnYVxNuJ5bc/8OssCAxEmU3nlj5R1QGh/7BuEL2vO0g2eBmy ZjD5ehryQNwo0oVIWH46yue/hVKr+casxM8L88RyZfmLU1X3i4jf6P6trkM8f2TFAtq3 16iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cxAXBC9m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c10si14356302plg.392.2022.01.24.12.30.58; Mon, 24 Jan 2022 12:31:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cxAXBC9m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347503AbiAXTed (ORCPT + 99 others); Mon, 24 Jan 2022 14:34:33 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:48994 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351152AbiAXT0E (ORCPT ); Mon, 24 Jan 2022 14:26:04 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8A2A4B8121A; Mon, 24 Jan 2022 19:26:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80ED6C340E5; Mon, 24 Jan 2022 19:26:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052362; bh=ZYoNT/gKCF32h7AuxcVFTRr05fgo4y6nVkWi1qiO7ks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cxAXBC9mUDIp13dJYDGLDL6vf1iDp4cphOJ8919jiKbm3QMFJJIvHGbzCyN6xfaQ5 2srBJiKmt0fcfWFw3nU8+8jZ3pyorI7w3uoTWN7MhHC35zT6/PeldI1toGFSoKtOzs AiI3Lc3clHto8lYD2KQsdEuT2lfaPFTyqjRun1Ss= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Sam Ravnborg , Sasha Levin Subject: [PATCH 5.4 034/320] drm/panel: kingdisplay-kd097d04: Delete panel on attach() failure Date: Mon, 24 Jan 2022 19:40:18 +0100 Message-Id: <20220124183954.911443634@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Brian Norris [ Upstream commit 5f31dbeae8a88f31c3eb4eb526ab4807c40da241 ] If we fail to attach (e.g., because 1 of 2 dual-DSI controllers aren't ready), we leave a dangling drm_panel reference to freed memory. Clean that up on failure. Fixes: 2a994cbed6b2 ("drm/panel: Add Kingdisplay KD097D04 panel driver") Signed-off-by: Brian Norris Signed-off-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20210923173336.1.Icb4d9dbc1817f4e826361a4f1cea7461541668f0@changeid Signed-off-by: Sasha Levin --- drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c index 3ac04eb8d0fe5..1e7fecab72a9f 100644 --- a/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c +++ b/drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c @@ -424,7 +424,13 @@ static int kingdisplay_panel_probe(struct mipi_dsi_device *dsi) if (err < 0) return err; - return mipi_dsi_attach(dsi); + err = mipi_dsi_attach(dsi); + if (err < 0) { + kingdisplay_panel_del(kingdisplay); + return err; + } + + return 0; } static int kingdisplay_panel_remove(struct mipi_dsi_device *dsi) -- 2.34.1