Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4445840imw; Tue, 19 Jul 2022 06:48:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vOiNczOBZu3PUp3qALbEhbY+QhR/JAzSGBZbjishcg0JKOsZzyJ0lhNRhonidVT3Lai0aT X-Received: by 2002:a17:906:9c82:b0:6e1:1d6c:914c with SMTP id fj2-20020a1709069c8200b006e11d6c914cmr29966532ejc.769.1658238506099; Tue, 19 Jul 2022 06:48:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238506; cv=none; d=google.com; s=arc-20160816; b=oJvwN/6jGVMSur5bdBsVoGAaGSv6dvO9xz0nS/5Jeyb8doemlQZjlOzbk7SsrPwoOX vpA/IcANE7lsK9fpV1WGagH/sqw+kC8v57RWml6bIqkRePxbKA71Bw3ErNm8CRIxYh5J CS3EaQU6mVgZ/XswPoAEqOQ0kDgpvnOZ7s3BnTblvnglvyZJd6lbmILxksNTabYTDSIs XTLxJpKhU4UeeWMdhtPjYsM4rmIe/X07FletBkVbMD77Pmuo2xqNC4qe71F/KTUQL1qY nPnyf1H+R4S9Eq9i3owLcGhE72zNBB+RXnhNkrAcALgPH7dT4j4SIzKl6OFiWt5w/qxv SHEw== 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=+/DA/nuaMT+Z8qm3rdHJoJEG2wjqFHTyZQsdMzRStg4=; b=juiXlhFflVuyeNJ9okOmuHwAkdFMqdZGOhobowYPfw2jdYODHwhiFZ7Pvf1QLlxlVr VGVMZHEFN2JbMzjEPjfmpWFxKuqDscJwuRmvrepVQyW8rY08OLDmCDyc1UCP+8awlW8z SY91bsGl5znacBEQxM6kz/fkvUPCSChOpYYE3MlUIzCIEamm7XV+s8UFOyHZDBltd2lC MgaAiaO4YHPfb3cEd1tdhnjRjJe+MD6Qb4+0HxPUDfZjTcBrSNwXQND2C6KDu+hiLo8r YyoB+z0WSCnh65JYil+cDuF/YMacf6mHhzX1iAksyN3x4k6ba6l4fWxBMOWFOssSpwDY 1XWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=duQS7WXI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t17-20020aa7d711000000b0043adae91e5csi16947692edq.611.2022.07.19.06.48.01; Tue, 19 Jul 2022 06:48:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=duQS7WXI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S238652AbiGSMKu (ORCPT + 99 others); Tue, 19 Jul 2022 08:10:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238553AbiGSMJF (ORCPT ); Tue, 19 Jul 2022 08:09:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D85F946D8E; Tue, 19 Jul 2022 05:02:12 -0700 (PDT) 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 6A89EB81A2E; Tue, 19 Jul 2022 12:02:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA65BC341C6; Tue, 19 Jul 2022 12:02:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232130; bh=/54opaxZzA9inRinu6kZ36+7FYhDedqpCarzFS/hmwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=duQS7WXIp9TghpiktfsENeUN7GpvV5kPYCiTPXvHe0IQFzURIyMm7MBFq5Cdk9OSU 8w3qBTp+5YhxjVLEs4TeeW4klol3kjNNj7+7Gvveci2aWRidpGeyOMaT2tkZKz2V1L +OO21ANYiy05P20pAwwvZV1jwIgfdo88yPz/CxyA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= , Rodrigo Vivi , Sasha Levin Subject: [PATCH 5.4 22/71] drm/i915: fix a possible refcount leak in intel_dp_add_mst_connector() Date: Tue, 19 Jul 2022 13:53:45 +0200 Message-Id: <20220719114554.365939156@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114552.477018590@linuxfoundation.org> References: <20220719114552.477018590@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 From: Hangyu Hua [ Upstream commit 85144df9ff4652816448369de76897c57cbb1b93 ] 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 Link: https://patchwork.freedesktop.org/patch/msgid/20220624130406.17996-1-jose.souza@intel.com Signed-off-by: José Roberto de Souza (cherry picked from commit cea9ed611e85d36a05db52b6457bf584b7d969e2) Signed-off-by: Rodrigo Vivi Signed-off-by: Sasha Levin --- 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 74d45a0eecb8..c59b43fb34a8 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -520,6 +520,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; } -- 2.35.1