Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2195376iof; Tue, 7 Jun 2022 22:51:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGwQjnsJfyQAq5E01/4rSxe0cSSLdTyxqmjtFZ0y+UiEwpjZXmXhnSxaMKb2gb3ZP4NGCw X-Received: by 2002:a17:902:b692:b0:14c:935b:2b03 with SMTP id c18-20020a170902b69200b0014c935b2b03mr32422792pls.81.1654667495039; Tue, 07 Jun 2022 22:51:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654667495; cv=none; d=google.com; s=arc-20160816; b=M2+OtwY2QYNjmRbXinktoR8HL9532DvFlAz9xHXzp79W09uHr16A7goZCQcxOFS2Ax AdfoRACGIGPjlnZ9sUpnW1NRTYvh+R2a9YAXWUfp33xmVj1w74SeX2AdkURMJBGQ0YKd jUADX1+YlQjMdoF4Cx7Z3he173vKKYNLjRT06Eko8P65n6fKy4iqp3d8E5gySrm9hylq J6RVEiVWorTFok0QRF49pDNOfzLUd+Fdd3AhDzQT2DYV8IyqEBG2nMF/w8tTb9W4uq0P qkh8JQDXVMrcL5OSUFVHniuKW+tTTbhX29eueIzJqQhOEWYqy0+gOMLOEJjAiv/A8IJj fFUQ== 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=IxlK5CSy7s2k9Sm1NG7YsJjS+u+WN1U4C03awutakIc=; b=Z2wj4YqgFNahEnyMk+v3iHTAf1jF1ruCpwTm5neUU2lU+7L1QeXw7/DnAWJAL7pUST +PHyHsJdRbUpSv23V5L9sUFnTFqk8qC1sBaV0IFnz0zoIQ99R3kKKHEgPj4RNmOqrUcF ECKGPnM5g9+GLHWyFlSDFK1p6DRRDd1rU67x5OQZ5MRAcn2etEkcKChjCTWWX0f7jooz 7y9hgRLxIQUN7bcSMVuN7bYRV3pRi0pn87sdyFzATNHRz+LtaSlQLsG7xnwNt+Y9+7xA nX7WQQfTXbc6Q1tD2W53cFhEPuLubaMwfjEJ8lh3najDpFnT4amaMKwttcE9AwsvxHjk O+Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zHM9IOL7; 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 f14-20020a63f74e000000b003fe20625995si3114853pgk.458.2022.06.07.22.51.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:51:35 -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=zHM9IOL7; 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 out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3092F3F7FAA; Tue, 7 Jun 2022 22:18:20 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243015AbiFHAsM (ORCPT + 99 others); Tue, 7 Jun 2022 20:48:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382142AbiFGVqh (ORCPT ); Tue, 7 Jun 2022 17:46:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86B61235B2B; Tue, 7 Jun 2022 12:07:50 -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 0D2D4B823AF; Tue, 7 Jun 2022 19:07:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EBF0C385A5; Tue, 7 Jun 2022 19:07:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628868; bh=83AZfT2oaqVByY9h8y63qPN/ORkZeBhxHxDtVV7kixs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zHM9IOL7lcmd0OFuD2iWD+rI1bliEfH1YKu5aTquzz/FWWsrPEYrBMNdfMSUKKws/ Y1Yo/CjL4KkWzVf1gb6qwWL/XvsGtwVkcfWnYCKOCw2GVoyZDzkOJsDTaaheQ2nV4g +7Au7qpxY+Z4TRGua+UA+plDz6dLw1JYZYIZPM2U= 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.18 485/879] drm: msm: fix possible memory leak in mdp5_crtc_cursor_set() Date: Tue, 7 Jun 2022 19:00:03 +0200 Message-Id: <20220607165016.950805606@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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 fe2922c8d21b..31447da0af25 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c @@ -997,8 +997,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