Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4452561imw; Tue, 19 Jul 2022 06:56:29 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vBqeHJkQu5l1xGcMQc72QI1ZsctvyKamEvHDJ7j1ch+hQiFgkTocsaOLNnb8t/l9Zu3TQG X-Received: by 2002:a17:907:72d2:b0:72b:d238:4e81 with SMTP id du18-20020a17090772d200b0072bd2384e81mr29453505ejc.104.1658238988919; Tue, 19 Jul 2022 06:56:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238988; cv=none; d=google.com; s=arc-20160816; b=tf8DYS92lJK6iLshYkMDE1KB0b1oq773UwS3GmLMdMzulTqVqGtkJOdDrbX8jgj21Q vPqM9sFwSqDt87YYshZucw/A/i/a/ErlwcKa6cIbYdh3/8VLD0Z+QNQ8yS8FzflwkzbH OPFd1KFxR2Wy55KdusB5S2RlfdxQSzDzgiBpb+MnU1+YXtQjehhjyimbQ3Lqvdc0TPnF obqRekP4nvRjU3dIJepYBxb5xkyzaZk6srzzRkniTrg7/55nxIm6WV+PZGcGAHMWuaTJ T0CThsw7bYs7ntDwlSmEnsoXeS4LdRWstAjEwNbQlkU/iTIJbw0EYkWvk0aVghoZISWV XqKA== 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=uKDS2ooloqMiDPBPUsrEjc5Xio+ISAvYTxki8clra2Y=; b=0e9RsCDlFOLAkoaOIKKMZDwNbArPcYrW6GMKbQiSwU1eU3zM4u9Opg24MWCsgUQeGR /fuzgo92J0+V3Dgty1InB6jJCQE/HFtVK58nWt/66UZ+cOFZ9hKwsAUb/7HrWFVJ0rGb +e+DwcGhTLoO3emmF2pnbvihrHjOXoVi6gKNzf0uZQBY+LuvvFM6ZlJdDkvf9YDUitdu ddbhtq10NXG8RzKBiRnK+Mf7Y6fLrTPScsgMqqRg+8mWBU4VxNCGSfFiRD7IuHuvB+rw 56qzeUzGqLBji7Pr8NTgdBE94fMknCXsDyRmE2Q1x+9taRE9ewsOGSPmZP5Z634u62ae +U8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qZB7+gb7; 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 qw29-20020a1709066a1d00b0072b83ed8d42si15278956ejc.82.2022.07.19.06.56.04; Tue, 19 Jul 2022 06:56:28 -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=qZB7+gb7; 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 S242074AbiGSMws (ORCPT + 99 others); Tue, 19 Jul 2022 08:52:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241662AbiGSMvp (ORCPT ); Tue, 19 Jul 2022 08:51:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B58D59269; Tue, 19 Jul 2022 05:20:30 -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 778276158C; Tue, 19 Jul 2022 12:20:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1793EC341C6; Tue, 19 Jul 2022 12:20:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233228; bh=9TA+RxkrpKyWsfoojvH5u63WM+TcAilnppvGCW8mEu0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qZB7+gb7FiDEuxz8AT3+u5+TqiGdx40+TbAMBbeVWFRrvvcDqQywcTCdcG+npbMYP ksyzGBF0rJQNMOw2IXXb0YUzY20J3lyH6ffrhD4oZX+WhYwYQKtiuvDJTpGDyXQec9 Z/93Lh4q1FbO4ztV/k5etJ/87OA+skptO3DXiUfw= 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.18 050/231] drm/i915: fix a possible refcount leak in intel_dp_add_mst_connector() Date: Tue, 19 Jul 2022 13:52:15 +0200 Message-Id: <20220719114718.471876890@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@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 e30e698aa684..f7d46ea3afb9 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -841,6 +841,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