Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4370947imw; Tue, 19 Jul 2022 05:31:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sttV0G6G0TsSOmKLRbbuCQ+GOxzdhHLATvPGKJpP/c7XYUHPQrj7rp+Hr3N9YnJfUvI5MC X-Received: by 2002:a17:907:2808:b0:72b:57c2:5e1e with SMTP id eb8-20020a170907280800b0072b57c25e1emr29514865ejc.577.1658233894347; Tue, 19 Jul 2022 05:31:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658233894; cv=none; d=google.com; s=arc-20160816; b=gU5uzNWfO8+VFtDh3ENBf1PP6JbgNDWBtymKFsc50nSRYyOfhtb5Htsqtr0Ts8HQGN QPyeeukQKR6vGUdgq7eJGXE0Z08qIxTozovNxcNyf8NCZ3G9WqR7Mqvk1nl7OTz6vzvV X7JYg4RNkt7BqyFjpoNQo+UOhoJrBSFj6moFqtXkqpfQkKiLZGvN1SmroVuHm9G1eOTo ERKQBqiaxiWkFISulDKGGMY04rdkgvA5A1QbR9K87HdxzAUIqRyg/lWDyd4g61P/jSqR YGFwTmNeG+UizGYMzysPNYHRDWXjEngooTO/bpc0I5S3YGf5XuLWIOcUo8/WLcETy5Vp YfqQ== 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=L7HOqLomnZjG0eeyG2JbH1Xzu5ZEG2sVd13UEMZ+bn8=; b=Nn3Rq2AYYWswW+kcsFLeP+EIWUOyk4qoiefKNrE9W8Nm9LwIBVnnFGjFIAcgK/sm7D zMLEBhuHs98V61f5UG5cVCUz717Xpl3wiIuHgN948n9F8HfDpu8Pw5CR85HjM4921PCk WPfM4gcHko1TV/XW0ierrlqRdr3Xj9TRpT66+jmRic51CMvg8eGcfKB/fqLSNoDBSXyt np9cAP81ppE85AWZku+u98q5G22tHfIUNQizV/GMtQzCRltcJ/FEmF4rwA497ZXtmL6e w5VIjipiFhycRSLukSw2uC1AvGqbcNFu4C2dH10NRyTJGQxz/g+80UCLYxq5ORWGCQ++ uf0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TN4ARJhz; 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 q6-20020a056402518600b0043b7f27423fsi2262560edd.232.2022.07.19.05.31.09; Tue, 19 Jul 2022 05:31:34 -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=TN4ARJhz; 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 S239389AbiGSMSK (ORCPT + 99 others); Tue, 19 Jul 2022 08:18:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239092AbiGSMQL (ORCPT ); Tue, 19 Jul 2022 08:16:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7C9B558E3; Tue, 19 Jul 2022 05:06:27 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 807F1616FD; Tue, 19 Jul 2022 12:06:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EC0DC341C6; Tue, 19 Jul 2022 12:06:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232362; bh=Y1ibfx5gZ3x+9GRpzoeqWy0wy1zYbYYTTXhhhPIAmSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TN4ARJhzkJ4OyeI7NfQolbsx8qO+WhmGvHpb2RJvuquNMVFVXMK9EmCezaTsqS5Ac ZeybyNxlIwy7PRsL55eZhs1/6JfeRRhCibmxBJ7KKACmu75wfvf2BOZZNKVGxIrYnu bni1Utm6h2VpPnvxSBQLf0KhBxQ28oVX1+VHTtVU= 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.10 032/112] drm/i915: fix a possible refcount leak in intel_dp_add_mst_connector() Date: Tue, 19 Jul 2022 13:53:25 +0200 Message-Id: <20220719114629.240121234@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114626.156073229@linuxfoundation.org> References: <20220719114626.156073229@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 ecaa538b2d35..ef7878193491 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -790,6 +790,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