linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Lyude Paul <lyude@redhat.com>,
	Robert Foss <robert.foss@linaro.org>,
	Sasha Levin <sashal@kernel.org>,
	dri-devel@lists.freedesktop.org
Subject: [PATCH AUTOSEL 5.4 19/57] drm/bridge/analogix/anx78xx: Cleanup on error in anx78xx_bridge_attach()
Date: Mon,  3 May 2021 12:39:03 -0400	[thread overview]
Message-ID: <20210503163941.2853291-19-sashal@kernel.org> (raw)
In-Reply-To: <20210503163941.2853291-1-sashal@kernel.org>

From: Lyude Paul <lyude@redhat.com>

[ Upstream commit 212ee8db84600f7b279b8645c62a112bff310995 ]

Just another issue I noticed while correcting usages of
drm_dp_aux_init()/drm_dp_aux_register() around the tree. If any of the
steps in anx78xx_bridge_attach() fail, we end up leaking resources. So,
let's fix that (and fix leaking a DP AUX adapter in the process) by
unrolling on errors.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210219215326.2227596-10-lyude@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/bridge/analogix-anx78xx.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix-anx78xx.c
index fcbad1ed865a..3ddeee3cc5a2 100644
--- a/drivers/gpu/drm/bridge/analogix-anx78xx.c
+++ b/drivers/gpu/drm/bridge/analogix-anx78xx.c
@@ -1026,7 +1026,7 @@ static int anx78xx_bridge_attach(struct drm_bridge *bridge)
 				 DRM_MODE_CONNECTOR_DisplayPort);
 	if (err) {
 		DRM_ERROR("Failed to initialize connector: %d\n", err);
-		return err;
+		goto aux_unregister;
 	}
 
 	drm_connector_helper_add(&anx78xx->connector,
@@ -1038,16 +1038,21 @@ static int anx78xx_bridge_attach(struct drm_bridge *bridge)
 					   bridge->encoder);
 	if (err) {
 		DRM_ERROR("Failed to link up connector to encoder: %d\n", err);
-		return err;
+		goto connector_cleanup;
 	}
 
 	err = drm_connector_register(&anx78xx->connector);
 	if (err) {
 		DRM_ERROR("Failed to register connector: %d\n", err);
-		return err;
+		goto connector_cleanup;
 	}
 
 	return 0;
+connector_cleanup:
+	drm_connector_cleanup(&anx78xx->connector);
+aux_unregister:
+	drm_dp_aux_unregister(&anx78xx->aux);
+	return err;
 }
 
 static enum drm_mode_status
-- 
2.30.2


  parent reply	other threads:[~2021-05-03 16:56 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-03 16:38 [PATCH AUTOSEL 5.4 01/57] drm: Added orientation quirk for OneGX1 Pro Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 02/57] drm/qxl: release shadow on shutdown Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 03/57] drm/amd/display: Check for DSC support instead of ASIC revision Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 04/57] drm/amd/display: Don't optimize bandwidth before disabling planes Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 05/57] scsi: lpfc: Fix incorrect dbde assignment when building target abts wqe Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 06/57] scsi: lpfc: Fix pt2pt connection does not recover after LOGO Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 07/57] scsi: target: pscsi: Fix warning in pscsi_complete_cmd() Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 08/57] media: ite-cir: check for receive overflow Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 09/57] media: drivers: media: pci: sta2x11: fix Kconfig dependency on GPIOLIB Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 10/57] media: imx: capture: Return -EPIPE from __capture_legacy_try_fmt() Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 11/57] power: supply: bq27xxx: fix power_avg for newer ICs Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 12/57] extcon: arizona: Fix some issues when HPDET IRQ fires after the jack has been unplugged Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 13/57] extcon: arizona: Fix various races on driver unbind Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 14/57] media: media/saa7164: fix saa7164_encoder_register() memory leak bugs Sasha Levin
2021-05-03 16:38 ` [PATCH AUTOSEL 5.4 15/57] media: gspca/sq905.c: fix uninitialized variable Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 16/57] media: pci: saa7164: Rudimentary spelling fixes in the file saa7164-types.h Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 17/57] power: supply: Use IRQF_ONESHOT Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 18/57] drm/bridge/analogix/anx78xx: Setup encoder before registering connector Sasha Levin
2021-05-03 16:39 ` Sasha Levin [this message]
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 20/57] drm/amdgpu: mask the xgmi number of hops reported from psp to kfd Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 21/57] drm/amdkfd: Fix UBSAN shift-out-of-bounds warning Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 22/57] drm/amdgpu : Fix asic reset regression issue introduce by 8f211fe8ac7c4f Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 23/57] drm/amd/display: Fix UBSAN warning for not a valid value for type '_Bool' Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 24/57] drm/amd/display: fix dml prefetch validation Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 25/57] scsi: qla2xxx: Always check the return value of qla24xx_get_isp_stats() Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 26/57] drm/vkms: fix misuse of WARN_ON Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 27/57] scsi: qla2xxx: Fix use after free in bsg Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 28/57] mmc: sdhci-pci: Add PCI IDs for Intel LKF Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 29/57] ata: ahci: Disable SXS for Hisilicon Kunpeng920 Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 30/57] scsi: smartpqi: Correct request leakage during reset operations Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 31/57] scsi: smartpqi: Add new PCI IDs Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 32/57] scsi: scsi_dh_alua: Remove check for ASC 24h in alua_rtpg() Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 33/57] media: em28xx: fix memory leak Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 34/57] media: vivid: update EDID Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 35/57] clk: socfpga: arria10: Fix memory leak of socfpga_clk on error return Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 36/57] power: supply: generic-adc-battery: fix possible use-after-free in gab_remove() Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 37/57] power: supply: s3c_adc_battery: fix possible use-after-free in s3c_adc_bat_remove() Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 38/57] media: tc358743: fix possible use-after-free in tc358743_remove() Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 39/57] media: adv7604: fix possible use-after-free in adv76xx_remove() Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 40/57] media: i2c: adv7511-v4l2: fix possible use-after-free in adv7511_remove() Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 41/57] media: i2c: tda1997: Fix possible use-after-free in tda1997x_remove() Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 42/57] media: i2c: adv7842: fix possible use-after-free in adv7842_remove() Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 43/57] media: platform: sti: Fix runtime PM imbalance in regs_show Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 44/57] media: dvb-usb: fix memory leak in dvb_usb_adapter_init Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 45/57] media: gscpa/stv06xx: fix memory leak Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 46/57] sched/fair: Ignore percpu threads for imbalance pulls Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 47/57] drm/msm/mdp5: Configure PP_SYNC_HEIGHT to double the vtotal Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 48/57] drm/msm/mdp5: Do not multiply vclk line count by 100 Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 49/57] drm/amdkfd: Fix cat debugfs hang_hws file causes system crash bug Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 50/57] amdgpu: avoid incorrect %hu format string Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 51/57] drm/amdgpu: fix NULL pointer dereference Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 52/57] scsi: lpfc: Fix crash when a REG_RPI mailbox fails triggering a LOGO response Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 53/57] scsi: lpfc: Fix error handling for mailboxes completed in MBX_POLL mode Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 54/57] scsi: lpfc: Remove unsupported mbox PORT_CAPABILITIES logic Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 55/57] mfd: arizona: Fix rumtime PM imbalance on error Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 56/57] scsi: libfc: Fix a format specifier Sasha Levin
2021-05-03 16:39 ` [PATCH AUTOSEL 5.4 57/57] s390/archrandom: add parameter check for s390_arch_random_generate Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210503163941.2853291-19-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lyude@redhat.com \
    --cc=robert.foss@linaro.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).