Received: by 10.213.65.68 with SMTP id h4csp2082683imn; Mon, 2 Apr 2018 00:13:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx494ugATe+2jxj6/9Rhi1M8PrVbU3sEpPYuojkHwv9cBfyX7tOjuMYGDSq26h1ZVAFhx3ZIY X-Received: by 10.101.101.66 with SMTP id a2mr5657280pgw.223.1522653199819; Mon, 02 Apr 2018 00:13:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522653199; cv=none; d=google.com; s=arc-20160816; b=npEOwDb4ryvkdPyXwdGA2oU7EsXHgDFO8a6WO67U1EYz8U0s6zoyPvWLV42ul6h51K 5NWmyIECt5iEP/976nGah/HjFnpcSEy7wGtTuZlL21VXSexPpBpUsmntxD0hLSgf+jpG CxzmMmR1EbGTLRY3mUa0zF8JmKXxWPHOQe+YqAtEf1pkJ9KF+yZJ9mMcCHqoTJPBYzIP HXVFrCOomOPDSDj9FK0YvphgR/mzDes8/nIcWyp1IALJ+sWRUXmIWL2otiljQJT0rgTt Agk7251zoaiGMprI48OBzmG3OCzI3dllVkbxuuAlP0k/d3rChBQsGlQBKQqbnnqqUhCe hASw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=O+6dDHoXxVmoPuCYxWa7Mw7lgjYKXsj0E9lzQ+J6D1E=; b=L4EzdaE1Raju3jIshJ7SOQvy6JEumV6SJKjn1wi+3F/jwQVe0YSu3LeTmc13tOjI4F cuJVJOLg130JgX3m9NADzhmJ0+KaP/0lGLRjHSkUcQjHReRFmUlM0KXCoWrdwk6dH58R JebKNa7PaQOk1644ysLM4EsOfEUi9FRefPMoptIx7kuvQcO7DHGZDiFiYuRRwDzInqYT Vz8spshOAsdwjN3Zd8ImDCACudHKybqamMNn4hFEJA5HkfNpdEKaITnMWkjhu7/IOuTe Iondevmdmj2faBmHWLJcf0imTnxT3rIPCSZREhO3fWdN9eR2mfpgIbkm0qT20g3apYR4 cMEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quora.org header.s=google header.b=CaMakeep; 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 i72si9239560pgd.65.2018.04.02.00.13.06; Mon, 02 Apr 2018 00:13:19 -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; dkim=pass header.i=@quora.org header.s=google header.b=CaMakeep; 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 S1754219AbeDBHKx (ORCPT + 99 others); Mon, 2 Apr 2018 03:10:53 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:36584 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754136AbeDBHKv (ORCPT ); Mon, 2 Apr 2018 03:10:51 -0400 Received: by mail-pl0-f68.google.com with SMTP id 91-v6so3628296pld.3 for ; Mon, 02 Apr 2018 00:10:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quora.org; s=google; h=from:to:cc:subject:date:message-id; bh=O+6dDHoXxVmoPuCYxWa7Mw7lgjYKXsj0E9lzQ+J6D1E=; b=CaMakeepvPs4Bugf5uIEfkqN7ABCIyhtmfIg1OfDhXoe9rACZI/i8gW8iqLToa3/a3 Xh9QBT8cNTi3LQQ8evhyLgwgVV1JAg8QpiFDzCxKRTYlYK9lXTYsC53pNdAS2UK6/Gfb sKTkT5XTCkqWy2z3LLwrSulgKY6QS51lSU6WE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=O+6dDHoXxVmoPuCYxWa7Mw7lgjYKXsj0E9lzQ+J6D1E=; b=Il/4SiVgDTbk/ag+d+1bjfk+JBBaJMFWCz/sG7G4b6OJJSKzzT5Q1ob7hh9Jc0T5Ic eBPntqnK3S/SpPmHPkFb0rhbj/Wb1PWrki+ixkk1c0RoMKdsDkOeXxU6hH1cTj0ehWnK VN7vDeYgUOVCFLnZf8pIPcKWAqztcOYXQWplRdRE1wJA5Lg9o94r0288/z0QSz1UvCW4 Gz4e/MSbfghTXSOq5CK3TczE7Mpuww+/woDhafagQDub2bYNmOnk279L4j28JPo+RtFL l0TFoUfo3PtIugDpsuP9I7k9qIWvjxCbSIw2VIYXhXC7+RMeR7Mr9Rvn1wbRbsII2yyS KFVQ== X-Gm-Message-State: AElRT7GX486RvlmPX7NADrZMhpv4tZP/1rgeNhNR3Vo5ANeoE2zwG98K D95XkpuOZDYgmg9SfAlez8MIosGq X-Received: by 2002:a17:902:24:: with SMTP id 33-v6mr8761215pla.341.1522653051375; Mon, 02 Apr 2018 00:10:51 -0700 (PDT) Received: from localhost.localdomain ([202.83.97.154]) by smtp.gmail.com with ESMTPSA id p3sm23554254pga.45.2018.04.02.00.10.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Apr 2018 00:10:50 -0700 (PDT) From: Daniel J Blueman To: linux-kernel@vger.kernel.org Cc: Daniel J Blueman , dri-devel@lists.freedesktop.org, Eric Anholt , Dave Airlie , stable@vger.kernel.org Subject: [PATCH] drm/vc4: Fix memory leak during BO teardown Date: Mon, 2 Apr 2018 15:10:35 +0800 Message-Id: <20180402071035.25356-1-daniel@quora.org> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. To: linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Cc: Eric Anholt Cc: Dave Airlie Cc: stable@vger.kernel.org Signed-off-by: Daniel J Blueman --- drivers/gpu/drm/vc4/vc4_bo.c | 2 ++ drivers/gpu/drm/vc4/vc4_validate_shaders.c | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c index 2decc8e2c79f..add9cc97a3b6 100644 --- 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 *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_object *gem_bo) } 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; diff --git a/drivers/gpu/drm/vc4/vc4_validate_shaders.c b/drivers/gpu/drm/vc4/vc4_validate_shaders.c index d3f15bf60900..7cf82b071de2 100644 --- 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_object *shader_obj) fail: kfree(validation_state.branch_targets); if (validated_shader) { + kfree(validated_shader->uniform_addr_offsets); kfree(validated_shader->texture_samples); kfree(validated_shader); } -- 2.11.0