Received: by 10.192.165.148 with SMTP id m20csp522842imm; Wed, 25 Apr 2018 03:37:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx49ucKE32k0Khos6h1rF213ptkvKYabufMKd3tFahgPg1OGE6kAB9roUNYEfDch9STZLX2Kv X-Received: by 10.101.85.140 with SMTP id j12mr23852827pgs.262.1524652621439; Wed, 25 Apr 2018 03:37:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524652621; cv=none; d=google.com; s=arc-20160816; b=nyk7lldPClf4opjr6msHwjsbFNhRl8mDnPxbRTyXbYhiPfzif2fGrQfzN63WPdgtop OiIqGz4LDKF6XkhHrLssOzukMSSl9uEthb40lFCL2RLgm9rrTZCZQZmOPu7kOAkVwCIi 6ks83HWsmirgxQxbEI/dVKeJjziNTTVSXMnx6hDbhCQbg5v1Fox3gTkKY97J7V97dpee pGZt/gFdyk9lb04LZKU9qWr0ZIIySGgN+qQH6wD3OsRXdMTFrDQFmCWuigKoUe6gJ8i5 o1J0+r72e1uuXTQHxlZAIrJswTAinhBmepzd0zreveNO+K1blZVc59pXJjL4QBgfPCan lIdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Ve4gEDozJKyKMdlvWwrTZfN8pUz6t1gHJhsk3Jr5Chc=; b=sObF+uCBcrhZP0pIqgjeRWEa0MMD4ysyACLnINjLzLkkNL5aGjy2WaD2z9yZSn4bZX Dovub7Q+z5iHbfglPcEL6XBuFMDKmWDWsUkgaHWQyR+k277uIoRp0JX34Qd6RnUHfZPo 3Y6MXuc7tla9RR7bw/Kx/hsqX7SoWPb9NOtn9IgdbiZ51OsE8YCDHCo7u47wAp46wC3U lMDf/rp1Y+NyO8txOXJkCIh/2Usk/g0ObBpjmDRfRdisB5MGOHFxJxoXjZVcBXVPtmPk Pgv2XR1GGR8titrXcE3vhVqkxMZO6zl1mn5OFXRQrDAzcK9RFVRx1ykXzU0BSsGovWKV 19TQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3-v6si17787752pli.324.2018.04.25.03.36.47; Wed, 25 Apr 2018 03:37:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753016AbeDYKfS (ORCPT + 99 others); Wed, 25 Apr 2018 06:35:18 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50998 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752935AbeDYKfA (ORCPT ); Wed, 25 Apr 2018 06:35:00 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 790CE49F; Wed, 25 Apr 2018 10:34:59 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel J Blueman , Eric Anholt Subject: [PATCH 4.16 09/26] drm/vc4: Fix memory leak during BO teardown Date: Wed, 25 Apr 2018 12:33:18 +0200 Message-Id: <20180425103315.226009669@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180425103314.842517924@linuxfoundation.org> References: <20180425103314.842517924@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daniel J Blueman commit c0db1b677e1d584fab5d7ac76a32e1c0157542e0 upstream. During BO teardown, an indirect list 'uniform_addr_offsets' wasn't being freed leading to leaking many 128B allocations. Fix the memory leak by releasing it at teardown time. Cc: stable@vger.kernel.org Fixes: 6d45c81d229d ("drm/vc4: Add support for branching in shader validation.") Signed-off-by: Daniel J Blueman Signed-off-by: Eric Anholt Reviewed-by: Eric Anholt Link: https://patchwork.freedesktop.org/patch/msgid/20180402071035.25356-1-daniel@quora.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/vc4/vc4_bo.c | 2 ++ drivers/gpu/drm/vc4/vc4_validate_shaders.c | 1 + 2 files changed, 3 insertions(+) --- a/drivers/gpu/drm/vc4/vc4_bo.c +++ b/drivers/gpu/drm/vc4/vc4_bo.c @@ -195,6 +195,7 @@ static void vc4_bo_destroy(struct vc4_bo vc4_bo_set_label(obj, -1); if (bo->validated_shader) { + kfree(bo->validated_shader->uniform_addr_offsets); kfree(bo->validated_shader->texture_samples); kfree(bo->validated_shader); bo->validated_shader = NULL; @@ -591,6 +592,7 @@ void vc4_free_object(struct drm_gem_obje } if (bo->validated_shader) { + kfree(bo->validated_shader->uniform_addr_offsets); kfree(bo->validated_shader->texture_samples); kfree(bo->validated_shader); bo->validated_shader = NULL; --- a/drivers/gpu/drm/vc4/vc4_validate_shaders.c +++ b/drivers/gpu/drm/vc4/vc4_validate_shaders.c @@ -942,6 +942,7 @@ vc4_validate_shader(struct drm_gem_cma_o fail: kfree(validation_state.branch_targets); if (validated_shader) { + kfree(validated_shader->uniform_addr_offsets); kfree(validated_shader->texture_samples); kfree(validated_shader); }