Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2750488pxj; Mon, 31 May 2021 09:48:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpSZoGJ/Ep98s1GmxW8oWOzQd7vjg9tLZjXKg7FeUNwhy2MfhF0DPdXW9gJvFbvJdaqSjt X-Received: by 2002:a05:6402:61a:: with SMTP id n26mr16957006edv.220.1622479707014; Mon, 31 May 2021 09:48:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622479707; cv=none; d=google.com; s=arc-20160816; b=LsDr1T/uEs9kVARMyOZAlJBqAZxqSRDys0rkdF78mcdUyNC0ekAsCP7LoUblxfgg/u pHmz7+qUz5qPZe4ssdyI6LefCjyScUUY8oxgTVr0BtYl15lwXegJL1yOsZCi3ucneGI/ DUVybMWCp//zhf0vhGda8tnAm3PF6gt4d+OQtznLk8OGkmwDEhOoYilnqk4rf2TuS96C YF6Z7/qnJMHnBth9hGVhQ5yg5+Hk3YA1WonKnlZUGD2p/hRqSEbennrvJK6FVnDhmePq KXIpeqGt+83pyN9RUyLwT6ABYhfocOhfd2fXrs/10jrQmcEFp+TGTNyzndBsWfDhExHG 4Fjw== 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=749pKWXvGiSeY9crTsQExWi6SwblKrQRy+9eMmxMx2M=; b=eZPPA55mUv+hehq+jp/DQfgiGBH0XFaFaeHDsB1IwGRRlwoWTSPO1xzg+4u+qYH6Vi RZpANfdpxj6/7lYS7KCKHb5412KJihVRhrnkC466yiRgqRe5Wc4M0oM2KVlsKZtaJruT VscnTFdtBDffyxyedRtEHBwGfXxhOyrBlmBNLs1unzDpnG8WY8J2clzviJcuXHzpi0ry FRJoU6JWrZWw/ZiXFtjMu9BK3uPLpyy5Uft5NSjG5WL3ce0of/nvWIaDhqz+dNyeWR0z +2lVKDpKKT2j6zTh+z/S1sR8JSdsvOwH28SymVdd4YBawLnPmWxBHI7+BjMh2FNAQJ8X xQlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="pvXpzQ/A"; 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 gb34si11752444ejc.697.2021.05.31.09.48.03; Mon, 31 May 2021 09:48:27 -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="pvXpzQ/A"; 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 S232495AbhEaQqc (ORCPT + 99 others); Mon, 31 May 2021 12:46:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:47910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231695AbhEaOzU (ORCPT ); Mon, 31 May 2021 10:55:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A347561CB8; Mon, 31 May 2021 13:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469570; bh=Bc5HtLcKCb6j8gDhgo0GQg4yPRCdbPNgRipY3n++qiU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pvXpzQ/AY/42souVtiUeIE0TBp6RK4OH1BZ4Kgfspt9qa1rjBGMnRNGXUBTo9M7xN c0qwXR3C5FMO6ig1+i8Ig2sRQNe7Zl9jrQGbAxdHJYOCAX0yDwkYxawaOI4LrXdOqp SNFPN7i6NKjGzvAM5AlaNrR12G0aD9VpUUP5mZZk= 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.12 213/296] drm/amd/amdgpu: fix refcount leak Date: Mon, 31 May 2021 15:14:28 +0200 Message-Id: <20210531130711.014834124@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@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 24010cacf7d0..813b96e233ba 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c @@ -290,10 +290,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