Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3571993pxb; Mon, 24 Jan 2022 12:31:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJzFPor7zC5YmCfMag/ejCWJrqmcYyAk0Km632/i7wv/Sju4rQMZ2JOp0sJTW0S+HtT8h+8W X-Received: by 2002:a17:902:690b:b0:149:6e91:9693 with SMTP id j11-20020a170902690b00b001496e919693mr15508446plk.162.1643056274331; Mon, 24 Jan 2022 12:31:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056274; cv=none; d=google.com; s=arc-20160816; b=bWe8734dZnJIuw5zfMifCZThByEq1pnPg8iuDZtylToUqiDDTwdCi6Eblqfi+X249p m8KomUlDfTTfYjCnsWAe+5Yi6aCbsCamDZnxEQwOZPs1DBy6Ir1hUags0EUY6x2ZBtjf sUOjTTwJ7BgnNN9DRWoYT8gdfBnACGO6RZ6+XFxWswlAOhmQWWwtJc2CceOPux6W7SNW jYi0O0EctLHhGnjkUK2EOIOeU7yZu6y3q94FxpMTOg8L1ntxKXyoLwAf4IgazN83+77V GkkFyp0FZJQdqDKp46YreMP/Dj8fu8tD6ebIGhR2cg5XxztL/8dpQT4K1RlfbmgcdZPa d5oQ== 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=/ErYxA8ioRKqRVGooWFd+SLD/brsznK/vsRc5XWr3T4=; b=XSg/r/kV5UjGjcVS1dlN4ePB6JkqExygtpUfJaaX1HVPBsnSPHMStOta9qEooToF+6 HQChGGFEZx7hk5OvWFuv6iFDGDsexP9Yut1m08z2/jadE0eUhme1Iu5Irc4VAAw7ignk sJ9ZhWd2DT6o31FAtlzzb2s1dTX4eQ2TYKXRcLmqLSQrZINdfyVrKfq2zN2d8zL99RU8 /6nM4Enr3wPmh59RjOf8qD47uL3tsDxiJnYACHFeHnYTEjnetZKvTM3RlEZS9HBMoU6N QCBIssrYCvzzE4BUKHZg+ZnXvmIftF7Eul/8OmcxLhqIroTQ8seaPSrZMWEgVHXnkJ7l GcAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eB3TJV5Y; 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 m12si13766951pfh.152.2022.01.24.12.31.02; Mon, 24 Jan 2022 12:31:14 -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=eB3TJV5Y; 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 S1353377AbiAXTej (ORCPT + 99 others); Mon, 24 Jan 2022 14:34:39 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49014 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351180AbiAXT0I (ORCPT ); Mon, 24 Jan 2022 14:26:08 -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 72EDFB81232; Mon, 24 Jan 2022 19:26:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1F1BC340E5; Mon, 24 Jan 2022 19:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052365; bh=MAqNBqkJY10xt9ZfgsqlIb9d8Hthqug4RgrqoOKK6xU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eB3TJV5YOEZ1WmC3e1RfIUszW70UqzgaMm+/3Ak8ksMy8O5EPZitmyic+isvWJ9Ic OJ4XR2Q4V5ix4aKLQ6Dt2jzNWvFmi39zOSjWo6ZfIB1sGPxyqBJA5NSES+PnyDAv28 3hYbzvEWeHIkSrN/ZK5FytwRnk1srqSrwcpRRAMI= 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 035/320] drm/panel: innolux-p079zca: Delete panel on attach() failure Date: Mon, 24 Jan 2022 19:40:19 +0100 Message-Id: <20220124183954.942378834@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 32a267e9c057e1636e7afdd20599aa5741a73079 ] 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. This problem exists since the driver's introduction, but is especially relevant after refactored for dual-DSI variants. Fixes: 14c8f2e9f8ea ("drm/panel: add Innolux P079ZCA panel driver") Fixes: 7ad4e4636c54 ("drm/panel: p079zca: Refactor panel driver to support multiple panels") Signed-off-by: Brian Norris Signed-off-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20210923173336.2.I9023cf8811a3abf4964ed84eb681721d8bb489d6@changeid Signed-off-by: Sasha Levin --- drivers/gpu/drm/panel/panel-innolux-p079zca.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c index d92d1c98878c1..df90b66079816 100644 --- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c +++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c @@ -509,6 +509,7 @@ static void innolux_panel_del(struct innolux_panel *innolux) static int innolux_panel_probe(struct mipi_dsi_device *dsi) { const struct panel_desc *desc; + struct innolux_panel *innolux; int err; desc = of_device_get_match_data(&dsi->dev); @@ -520,7 +521,14 @@ static int innolux_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) { + innolux = mipi_dsi_get_drvdata(dsi); + innolux_panel_del(innolux); + return err; + } + + return 0; } static int innolux_panel_remove(struct mipi_dsi_device *dsi) -- 2.34.1