From patchwork Fri Jun 24 13:04:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Souza, Jose" X-Patchwork-Id: 12894477 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4632AC433EF for ; Fri, 24 Jun 2022 13:04:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C8E7710E12B; Fri, 24 Jun 2022 13:04:31 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 78D6A10E12B for ; Fri, 24 Jun 2022 13:04:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656075870; x=1687611870; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=osY20LWSpBnvjqOSag5yBOsT/wAhBZecxfnYyaFEacI=; b=e0r4ZkmQIIX3byMJ7St4GwrBEMlKaRNh2r7BNGmjffxnDwvMTiVDppL6 jp6KgzCKa2PYMXLChTPVe4g1c+VzE0zkcWlOkaVLeqCjE+yQv7K+g02eq H1FACZaciWOl9T6IvoKye5SEwQd6gUsOWHgvTOYd0xXCnYaYUTnfMhKQO SdxF7y+2f3AmQwxL7GXnC8l6dt2aLQrRzAX5Ak+cmHJzKKRRtOxphljvV GvXdjDxlARB5ERl5c9qQyt7Ovu+WJcwqwcmlg1ZUwlMj2Lw62A/jtNCWd eZe+irQZ9DSWLEQSFtATFnCxrANFY47r4FlZajKv/DWj/J6Iq0w7/amt8 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10387"; a="306462075" X-IronPort-AV: E=Sophos;i="5.92,218,1650956400"; d="scan'208";a="306462075" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2022 06:04:20 -0700 X-IronPort-AV: E=Sophos;i="5.92,218,1650956400"; d="scan'208";a="656637948" Received: from josouza-mobl2.fso.intel.com ([10.230.19.134]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2022 06:04:19 -0700 From: =?utf-8?q?Jos=C3=A9_Roberto_de_Souza?= To: intel-gfx@lists.freedesktop.org Date: Fri, 24 Jun 2022 06:04:06 -0700 Message-Id: <20220624130406.17996-1-jose.souza@intel.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm: i915: fix a possible refcount leak in intel_dp_add_mst_connector() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hangyu Hua Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Hangyu Hua If drm_connector_init fails, intel_connector_free will be called to take care of proper free. So it is necessary to drop the refcount of port before intel_connector_free. Fixes: 091a4f91942a ("drm/i915: Handle drm-layer errors in intel_dp_add_mst_connector") Signed-off-by: Hangyu Hua Reviewed-by: José Roberto de Souza Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/i915/display/intel_dp_mst.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index 061b277e5ce78..14d2a64193b2d 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -839,6 +839,7 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo ret = drm_connector_init(dev, connector, &intel_dp_mst_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort); if (ret) { + drm_dp_mst_put_port_malloc(port); intel_connector_free(intel_connector); return NULL; }