Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2154423iof; Tue, 7 Jun 2022 21:34:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUoNpmN9KPGlJdoTEdCe8mbJkC202vHP63PnTQwwZuFSiGp0TuRCI71MgAoVhpXqNOZr3t X-Received: by 2002:a17:902:70c1:b0:162:1fbb:33f7 with SMTP id l1-20020a17090270c100b001621fbb33f7mr31721587plt.9.1654662858802; Tue, 07 Jun 2022 21:34:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654662858; cv=none; d=google.com; s=arc-20160816; b=mYu346yIwtaQvNDpjhKtf1el3+cv9xyXLvT7AoKjRIe5lC1/zwXb+uD6VbvBw6mabM 2fLpRMAeo/KbMlvvNFG+MOoDZ+RlmVdeRhAEu3JY9Itt1ReJ47fWvUF42N/4NbU5WS6T j6077VB9UOuQ42SAC2THxw383aGDkvpJf6awR+bypLsQlKuBdKYeXbRDXbC2wq6HCaKe di31NbzZSnZokmzbqSnX3Qd8OGNTezE8W7QgFHMhfbYxSC4sqvmlEmKbscdsg7hwblSw bVjt42gqTarwNfUyO6RWErNqXIVwqqWWco9v4CO509nHyjxvrJGgBsEQEhNHLRtJ1nVJ 5nxw== 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=BlOTAcl2GUcmtNLf6SZOImnF8u5TWLG0haTrwD90KRw=; b=qyn5BAASUXZvPQgL6NOEDNQmIsIjXSnS6XxR121QbVZCI/0u3Gp52CyQIeQjiJx9ZL 6jt8HPplVImrL83MMmo3PVWakKT6Zl0OelogAFLHZar10SFT+NLgk+EGf+4LsRFy2If5 2QnBa1/VoIWIP59nqitcxR6tBK7A2/rDCMk79ZVbFAZYzMZmUbtLKR92++BhtEI74Wp0 R48VnM2roqsAGNcLBQfyce8k3pafni33sr2d4spnNe5HiyQpOd/Vno4M39byToa/llO+ m2JBcPVqSNQ/JBQ0K4ERsmsjvveMkG9tohuPZtoiXOafbm9O7tjVJPzfl2qzwRcM+1b+ X1Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TkxP9h2p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id x14-20020a63cc0e000000b003f5d7e95185si26797926pgf.280.2022.06.07.21.34.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:34:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TkxP9h2p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3BE3F15FC2; Tue, 7 Jun 2022 21:02:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348508AbiFGRtB (ORCPT + 99 others); Tue, 7 Jun 2022 13:49:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347967AbiFGRb1 (ORCPT ); Tue, 7 Jun 2022 13:31:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C248311CB55; Tue, 7 Jun 2022 10:28:58 -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 3A851B822B0; Tue, 7 Jun 2022 17:28:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FFBBC385A5; Tue, 7 Jun 2022 17:28:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654622936; bh=2j7o75Snrv7Dgn8DW99eVATPtDQZVnpiMo3Wkpu2h+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TkxP9h2pVqObs+2aOi/q7pcMy5/vbNuujNH45b+baRtqY/pTX+ptKP1BO6Z5tDeUq +q227GMNB3irO3AYgqOhs6d/T1OzUQTueYI5FLl1O9RfqEoSuex5qvbcZMN3TG9a7M RKBVStEGcEyR0Mlg6rkx3hImMb9a4e6k7d0zM59Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Rob Clark , Sasha Levin Subject: [PATCH 5.10 235/452] drm: msm: fix possible memory leak in mdp5_crtc_cursor_set() Date: Tue, 7 Jun 2022 19:01:32 +0200 Message-Id: <20220607164915.563387026@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@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=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 947a844bb3ebff0f4736d244d792ce129f6700d7 ] drm_gem_object_lookup will call drm_gem_object_get inside. So cursor_bo needs to be put when msm_gem_get_and_pin_iova fails. Fixes: e172d10a9c4a ("drm/msm/mdp5: Add hardware cursor support") Signed-off-by: Hangyu Hua Link: https://lore.kernel.org/r/20220509061125.18585-1-hbh25y@gmail.com Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c index 06f19ef5dbf3..ff4f207cbdea 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c @@ -983,8 +983,10 @@ static int mdp5_crtc_cursor_set(struct drm_crtc *crtc, ret = msm_gem_get_and_pin_iova(cursor_bo, kms->aspace, &mdp5_crtc->cursor.iova); - if (ret) + if (ret) { + drm_gem_object_put(cursor_bo); return -EINVAL; + } pm_runtime_get_sync(&pdev->dev); -- 2.35.1