Received: by 10.192.165.148 with SMTP id m20csp756699imm; Fri, 27 Apr 2018 07:04:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqMDETLeRXq5t/43Qm15LCdqYk7YfQouhyTFG5hnDuAh4JiMrcTUU2R0dSBFV3M9eKrMn4x X-Received: by 2002:a17:902:bd84:: with SMTP id q4-v6mr2502093pls.254.1524837869141; Fri, 27 Apr 2018 07:04:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524837869; cv=none; d=google.com; s=arc-20160816; b=PJXWflq1XbXwuGC2bnCs15WzS1itV4+wI7RQQOAeTGvdTybaf+Rf50dkFZpFRel0Ir cF0z2oH5I+RTnMjO+W2AQQ2TH1GsnPScCAGRVztKYkmv8pA+dude6q55OJH1HFsWzB9F F8cA9p2lH0185UrSE2w8AoaZP43u7nFldS00UzaB03sWAGNNkKXdJvsMQvQdMyhfbTB+ FjMWMOnT4vudjL46nnwn6nbqTwBRvm9WevUj1Hi0sR7tNh/mT5pQ5VjQLtsnRLU/r9tk zlLeQVqIT8VRAOqlloTP43/naKcWTY2KO8EK2ACmqMncNcwTkWhG6DLmhFIcdXV3ow1Y usDg== 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:dmarc-filter :arc-authentication-results; bh=E4tnjRm4VFfkwJK9hzhgnvRk0/hbBoxs4nTEMIKyuJA=; b=cIWjcSwGkXlOgagc2EUeG7iwHuVgtaYGSCBvUXdK/ayJotZsmIAOV2tBoxckmnWQvx 5xtr68CuZFluYX55Zkz6M+gRJazQhtWwA8xTLm25pFqXMDIByI9lwXoSLZlGnn93PCK/ sz78/vp3F4WSv4kQtgLRH8DjtXHohsDbSYBRa72P8KrtichgpHN2pLmozs8YPSt0qUzC Rnywj3eOB61rA2/7UUucEf766FSoFw2785doPWIeuYC7/q+YXwDg/9L0qS/psCRBoQlV EImlfF3LKrQAw9AHZjm+ARsiQ1p1b4SHD/ixyf/DAQb8+XmR31sEtQ2JyAxfX8m2QL3V OZmg== 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 r1si1312312pfb.247.2018.04.27.07.04.14; Fri, 27 Apr 2018 07:04:29 -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 S933448AbeD0ODD (ORCPT + 99 others); Fri, 27 Apr 2018 10:03:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:49596 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933430AbeD0OC6 (ORCPT ); Fri, 27 Apr 2018 10:02:58 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3048921897; Fri, 27 Apr 2018 14:02:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3048921897 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org 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.9 03/74] drm/vc4: Fix memory leak during BO teardown Date: Fri, 27 Apr 2018 15:57:53 +0200 Message-Id: <20180427135710.038433411@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427135709.899303463@linuxfoundation.org> References: <20180427135709.899303463@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.9-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 @@ -80,6 +80,7 @@ static void vc4_bo_destroy(struct vc4_bo struct vc4_dev *vc4 = to_vc4_dev(obj->dev); 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; @@ -328,6 +329,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 @@ -874,6 +874,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); }