Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2671056pxj; Mon, 31 May 2021 07:55:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynC0ekW+dHBmLOQwzx1/SdxlazHP9wDXhzKB8age0/b+YDytphpKKnM1w2U5YHYvWKF/NN X-Received: by 2002:a05:6602:229a:: with SMTP id d26mr17091441iod.201.1622472900418; Mon, 31 May 2021 07:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622472900; cv=none; d=google.com; s=arc-20160816; b=B6avO0uADg/g5c9vMbXEc6MKm5J6aUWgvG5i2ysoOyBKqkTu9RievfDVdg2t3CGpfB 9yGVJRGTtUXgVwdI4UbDH9OEbY0LguCl2RCl8WJBLEYdx3mMy1xG1KP3nisTfmVuu0T8 3jLUdd4Jba77+x8IvsWiVK9+B5hhMpOBawRbHgkGN6jqfxs6cojZ8cmYlcq+gcbT33rp KIkeB3yb4n9aNRnkq3qk4TqJKVoPQLOj59xyYY5LYp5IVv7D96jH9L5tqS00ebN/x7Og mq4dYOQrfC2xywPkywTz4nb10fq93ZGPscMk8qNyS1ykt49Ps76LCO97wZ9LK+lRxf90 jhkw== 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=AhXAJlOOCnxYsI73ppiuBp/tiwb2jHjp6pakhLSR34U=; b=d9/u8GUgc0Ru8U+fWbZAcZddsfMG6Nhy9A6Yk9EGoB8t/ENqLQrXR68xsLjtyYAK67 uTbOK/qZqybpRohxyeTVK99XHRcZvKNCUtQ6iUjc6Ktr4xZ2v4IOBZOP2QatpBmvND3v NAKzxD6DqEKiL0bPh6dNQekhz9RMbPJWNpOUMj3ioPXvZGqp6FV+Ot5+a97BwM7OChyy oAhyefYe5pmrV3B22lX1xoNf90zWl1/7pXyLU1NW0GM3sRH9kNSlQPbS6uosuGDbmbJc Tz5eiia1mKjIerCfayFHzY3z/sd35DQJQws8SmTfP3/FG0ndE0KWT7aeKXkHnI9iUDUg AiKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T0pMrtWW; 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 d8si13955786ilg.2.2021.05.31.07.54.47; Mon, 31 May 2021 07:55:00 -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=T0pMrtWW; 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 S234345AbhEaOzL (ORCPT + 99 others); Mon, 31 May 2021 10:55:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:37384 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231219AbhEaOD5 (ORCPT ); Mon, 31 May 2021 10:03:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 49E7A6194C; Mon, 31 May 2021 13:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468276; bh=xGou3xu3WMhEItva0gKR7+VwTCk+xQj8PAChKyy1Mxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T0pMrtWW2Wzk067mPlRt9k1t/Qw4GRwPahB8YntQ3Jb6T7sJ6z/JxgxWZYeGj0EbE kAusZ/RyQXI9f5bJfPCUFo6fYsmjVOt6gPTQn3oqxfTV/3CFbyBmdln6MDU/izxdFn r+/P+mPHWgrvp3p0VMi+JpqI/RKzcf/A+VFzS+14= 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.10 182/252] drm/amd/amdgpu: fix refcount leak Date: Mon, 31 May 2021 15:14:07 +0200 Message-Id: <20210531130704.193621612@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@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 1ea8af48ae2f..43f29ee0e3b0 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