Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2627171pxj; Mon, 31 May 2021 06:54:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqXIfpajnoP+UINxTb80mpxvdREY/HBopzK16CtDsOXYH4kfxCCxTepQo/ybzp4dR7QTSh X-Received: by 2002:aa7:cb84:: with SMTP id r4mr25428427edt.187.1622469279032; Mon, 31 May 2021 06:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622469279; cv=none; d=google.com; s=arc-20160816; b=vWjv7Vt64DEuK5C5QYJwMrMJgduMdl4JoRdIjy5+n/EerFZ7vejFU+xnC47fprn9AU oqeA1BfCnnHMMr1d70ZKYHxi3TJj+zuhXvuFer7DU+VNqKnfHkFuBP01xCPmZewyfXpA V9eEiBeP61FZtAnp8O/N+SEVm/iTI+xL3abLh6Z5V5V+dNCsQ51wCcqLRefCZ/SmwZbq Wr/C85U+Lq29P+ZfwRf3k7ra9lvskuuCtnUXlQH9JBgjKwaqc+AZPjWBqbSyHPAL33YZ wb589q2vam8lj3FIpNxEZlOhwgSaX9FlUBoiBJJbtz4qzNWtkTq74dongMdXLdFQvslX xLxA== 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=/gFSynKqcXI7GzEH/qk+KjuOzxdqB70bOOouFFVXeF0=; b=UNozuZaPYG61stkzyZV7BMc/JerEvTShVzCKtQi0Rel7AZshsXzlDjYake25UZ8Yuo vgoKjgzczXSmF84uKErC80bVPZOGOFgigW8Zl3N5BgAuIEbvlccbYHsg0HC71rREOmoK aPdmISJ+0kd2WVkUJ7vW4QLXgZBGqL2e+YccHji8JUcITpMHPNDdLffY9zV/jXtzL8rC 6n6MytPgJK8tGcEdcFXquMKOTvokh6Ic2ZjDcdQiFKLEhK7gGrdyvG5ri2ppn0Wwqm8m rORZ/VnMe81Qbm7l3invEn2pH55msEpby1auM92bEtF9doS3bHR5chGXXE/IiAX3+WRj iSrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lDV4Q3oa; 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 v18si12259918ejy.223.2021.05.31.06.54.16; Mon, 31 May 2021 06:54:39 -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=lDV4Q3oa; 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 S232648AbhEaNwb (ORCPT + 99 others); Mon, 31 May 2021 09:52:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:38982 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232006AbhEaNfV (ORCPT ); Mon, 31 May 2021 09:35:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4A0F561442; Mon, 31 May 2021 13:25:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467515; bh=ELrSf7ipyOGhnwcsBgG+KpJ2zLw5e3XoUzLD75AMy1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lDV4Q3oazJtiFGJ+8hInd/2wl2+EaeGG9yx1989m565XwNzZcZftb/hY+ukZNFsca uUklFvhqwlu5WC+JF3v9IXHLOYuRFTnEyOYrR+c2JM3L8SX0EfGz6Avy+ZysR5dFo1 4LV6NdlqxfNqrn+MkMaOi0H7xXdL38AF7m8WoOpM= 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 4.19 094/116] drm/amd/amdgpu: fix refcount leak Date: Mon, 31 May 2021 15:14:30 +0200 Message-Id: <20210531130643.323804707@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130640.131924542@linuxfoundation.org> References: <20210531130640.131924542@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 69c5d22f29bd..d55ff59584c8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c @@ -297,10 +297,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