Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2709116pxj; Mon, 31 May 2021 08:47:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9AAM2zy3s1dg7arq/PbQFi/ng6OGzveCRXa8LTwvHr0thd2hBIkP80ftEnQ39xO/aGicx X-Received: by 2002:a17:906:8318:: with SMTP id j24mr4973623ejx.375.1622476027502; Mon, 31 May 2021 08:47:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622476027; cv=none; d=google.com; s=arc-20160816; b=bdumpV5F/jNjYUmmlbOmUBdeLdEuxJyh+gubIcHslvien8iWRRNx7gZl8NtfKvOimg LLs+Xxvj9RO4YX740dvnKkhZTwGHxC40ch3hBOcuk9WJY1clqmM70NyHwaKDT0WNtgzO RXMJQTqgTDd0cHyW1BwQljVSJq9BCuheG8FGYIr6G9gf83DyLfaJ6MvwAIrtOz8lBbQL 1zAqW4oZ57ZVVZM7G1wO3PZjKjVAMasacwf8kB7FtKliDd356P7a0CfS6G/NJup3Wrjg DU4HcGq3TJzzA75sa79xGOdIpUpsPH0WmWRlJNE6byH1422u7BIZhzYGpxlCphSkHD/y 9auA== 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=ifhgVBU3ozmX6qDGErpNZ4vOnjP7oymzIlCddZBiSvw=; b=h+VG+m02/KtJSO4pn3efLin8HKKIZJa04qXiBzIdNXHt05guHU/VlfsC6h8ey3rl7h 35iS3cjuewkvpzhif6iawexuK0o5AbjEHen6/FtPuSJtS+WYTXyP8e0+ymKxqh40dsPP 8bkvoJKnow8G+O8q/ld6sez6/T4fmaW32RCEqjTUNuuVVvNeU2gF39J/rP+8hwWaWvO6 gBWRJuO2r+5Z6qpL97222wh8GnS1e8C/F1ymvGvSeSajiMfxR3+qf3KJfspv4+E2cZ6x I+s2P0oYOcq1sTwYMKQEx5pgba8FE0/vvyQT6VFH6EhhVtFzuQ2AJiNAS7So5E8RLFdt Eqnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bJaAdNKV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n15si12643114edt.229.2021.05.31.08.46.44; Mon, 31 May 2021 08:47:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bJaAdNKV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232680AbhEaPp3 (ORCPT + 99 others); Mon, 31 May 2021 11:45:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:54474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233051AbhEaOZV (ORCPT ); Mon, 31 May 2021 10:25:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3BD5E61090; Mon, 31 May 2021 13:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468794; bh=JBOeN3H+DrfX/4RsOCC4AuOnCE8jCDALZYRSu3narW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bJaAdNKVlpv34zUURgZFLhL1457s9nMudrz+WqbhzfU/Bp+zmIyqlEQ1f1HxZIdNU Bk2T4JlxbfxNI8wEh6SZN027TBcZusQhEqU1p+6vTbmrJI0+OdaYUiKcjNencPbMEx i2eBWnmHrTbX+JnlH8aHgQy2UW1vVQozMJqJXGxY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jingwen Chen , =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher , Sasha Levin Subject: [PATCH 5.4 132/177] drm/amd/amdgpu: fix refcount leak Date: Mon, 31 May 2021 15:14:49 +0200 Message-Id: <20210531130652.502210445@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130647.887605866@linuxfoundation.org> References: <20210531130647.887605866@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jingwen Chen [ Upstream commit fa7e6abc75f3d491bc561734312d065dc9dc2a77 ] [Why] the gem object rfb->base.obj[0] is get according to num_planes in amdgpufb_create, but is not put according to num_planes [How] put rfb->base.obj[0] in amdgpu_fbdev_destroy according to num_planes Signed-off-by: Jingwen Chen Acked-by: Christian König Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c index fd94a17fb2c6..46522804c7d8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c @@ -289,10 +289,13 @@ out: static int amdgpu_fbdev_destroy(struct drm_device *dev, struct amdgpu_fbdev *rfbdev) { struct amdgpu_framebuffer *rfb = &rfbdev->rfb; + int i; drm_fb_helper_unregister_fbi(&rfbdev->helper); if (rfb->base.obj[0]) { + for (i = 0; i < rfb->base.format->num_planes; i++) + drm_gem_object_put(rfb->base.obj[0]); amdgpufb_destroy_pinned_object(rfb->base.obj[0]); rfb->base.obj[0] = NULL; drm_framebuffer_unregister_private(&rfb->base); -- 2.30.2