Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1161411ybg; Thu, 11 Jun 2020 02:34:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfE8D2dojNNbsStNYkDwmrs3k5/6X+CdOh5kPnDFSVXBp6nEqlf1rU+JJUt0hkWgp/kPsf X-Received: by 2002:a17:906:abca:: with SMTP id kq10mr7372710ejb.242.1591868056750; Thu, 11 Jun 2020 02:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591868056; cv=none; d=google.com; s=arc-20160816; b=JSW078hhPhvS6cUKx2NfX8/0wZpw0+uR36+/Sru8ygBINj2aM4+kVoSDYfb8jR5ecf NGzalHJ+BOrAHPDb7bVxevtIRw12H3s0bGwhsFg598ewd/M4WDIPs4rcubIeOuzT7Sd5 MkKNLpkwOcLRQdYkED+4kjuXYajBAutg8ZstSNyA6XxcrJ1SfV1x47dWCbjy+8D/H6GW qivIAF4t8E/ZvNlAB6lWRPqghD4c5yQQIl3qZ249VwDYWy1DtxjKiNdVW6o1/iqUEtlV JPpiRgQyzSZRN0Ql8ZbvBb2I/X39FrlcbQq37/940wUyFbrHOR2M4Dvf4ZpM5IOTr3js MHvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=zDk1R4++nQu3ABL1XNo4YqT4/I9bKpy89D+RQDKLWzw=; b=HG50zqBgjN/g6IbCE5Bt9wlaWsWgbM/t/IzOJ+UGlPTHZFOmTpqnCyDi5kG/CUSkXo 10gFsrivA2tV2hcvrV6tS+KsB1rnE6ZbmDXyP0aAeBxmsimuMb8ktVaurc1q0Mj7l9Fo wfdRmddrfvry/MNpiT2U+80fvpfcW+1NDCQcJ9xqpSQuugVlQBuX58f5ELArQpiRFRVI k1m5t6L3VAJFM1CFnQSk11brBQG8NHix3P38DrQCdben73lHwvQk0LZaa6N1+4KI5ucM 31WL0SUI5Qjln8h1Xof5YhRACuZi+DMpneSrlQWTZP8RQ8Oy3Mwr+Ftd4pf9wEWXw8n6 k6xA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p26si1365893edx.191.2020.06.11.02.33.52; Thu, 11 Jun 2020 02:34:16 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726945AbgFKJbY (ORCPT + 99 others); Thu, 11 Jun 2020 05:31:24 -0400 Received: from foss.arm.com ([217.140.110.172]:49146 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726803AbgFKJbU (ORCPT ); Thu, 11 Jun 2020 05:31:20 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C1ABF1FB; Thu, 11 Jun 2020 02:31:19 -0700 (PDT) Received: from [192.168.1.84] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A02333F73D; Thu, 11 Jun 2020 02:31:18 -0700 (PDT) Subject: Re: [PATCH v2] drm/panfrost: Use kvfree() to free bo->sgts To: Denis Efremov , David Airlie , Daniel Vetter Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Tomeu Vizoso , Rob Herring , stable@vger.kernel.org References: <20200605185207.76661-1-efremov@linux.com> <20200608151728.234026-1-efremov@linux.com> From: Steven Price Message-ID: <9cb39a92-5cdf-38da-98f8-b513dcdf69db@arm.com> Date: Thu, 11 Jun 2020 10:31:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200608151728.234026-1-efremov@linux.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/06/2020 16:17, Denis Efremov wrote: > Use kvfree() to free bo->sgts, because the memory is allocated with > kvmalloc_array() in panfrost_mmu_map_fault_addr(). > > Fixes: 187d2929206e ("drm/panfrost: Add support for GPU heap allocations") > Cc: stable@vger.kernel.org > Signed-off-by: Denis Efremov Reviewed-by: Steven Price Thanks, Steve > --- > Change in v2: > - kvfree() fixed in panfrost_gem_free_object(), thanks to Steven Price > > drivers/gpu/drm/panfrost/panfrost_gem.c | 2 +- > drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panfrost/panfrost_gem.c > index 17b654e1eb94..556181ea4a07 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_gem.c > +++ b/drivers/gpu/drm/panfrost/panfrost_gem.c > @@ -46,7 +46,7 @@ static void panfrost_gem_free_object(struct drm_gem_object *obj) > sg_free_table(&bo->sgts[i]); > } > } > - kfree(bo->sgts); > + kvfree(bo->sgts); > } > > drm_gem_shmem_free_object(obj); > diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c > index ed28aeba6d59..3c8ae7411c80 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c > +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c > @@ -486,7 +486,7 @@ static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, > pages = kvmalloc_array(bo->base.base.size >> PAGE_SHIFT, > sizeof(struct page *), GFP_KERNEL | __GFP_ZERO); > if (!pages) { > - kfree(bo->sgts); > + kvfree(bo->sgts); > bo->sgts = NULL; > mutex_unlock(&bo->base.pages_lock); > ret = -ENOMEM; >