Received: by 10.192.165.156 with SMTP id m28csp1680438imm; Tue, 17 Apr 2018 03:45:52 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+h01corDhR6i8mVhKNJtzCPupAomaqJW8P9k7imrmyxJ+xOct8Om2WG/h5i3i1/UnTUGsR X-Received: by 10.101.74.9 with SMTP id s9mr1332662pgq.91.1523961952098; Tue, 17 Apr 2018 03:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523961952; cv=none; d=google.com; s=arc-20160816; b=cq5d/5qLsl1DQufOhZLhyP9/pPd2UboeWLjaxI/69hwT7pGPQTlwEeOzMtsLffCZYd dcPexr6H1BjPz5xj7zvF+N/KV3ePLOX1fQEc4HBCyUqn1EDxpmyYgQU542R5jZOJjgjA WUel+3TfloOX3m0jZg7qsCI+jGNX9GboBf9fEY6marAdriN2scj0zxCUPs4qrcjtdIWi hyW75Z4e0MxxlMSVCSmprr0V3npCeEb1HBrrA8h024+Don6mw+RAXe5/hTnSrzJtd3lO ztBvUnqJWqGATCMyfLE9gHC92Mfzbtj1CFCtUxCCojqRpe8zJgJrUVNF9ZHD3N1kem+E 0Faw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=Qv5ysAAlC7PED8lgSiPCG5KrfVzhiYu4V+r8F67r/KE=; b=lp6B7N0/KzIqrXp2DIRlwcQWbcbAa4MMF/EbfGPOqRp2jMqL82BNSV5dvwC1h3v/fp Ooe2VJRs0uJPDV6TgK5TUwVT37EMkm1mcrJgcH0c8k6xKCqPZinayVx8AqzZkcksqimC c/lfDWgYlq2vCtOgadr7GBX/YmvVi43/SWzpQJYA0BUWnlZk23bt9AQ0bwyBAnApDIdu KHP0OXb6JK0i3PziHE/EUKSaFXcbEQKFsLX5icV9j82cSsl7650fI2LuarKkG91krGAe OHVHaW2rKkr4ytiCA+p6ibXZU0a029sscG0lU3V5VtFIESOTS1vc8MtJ2CGB4bDF56vS Rcyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=XX3YbZCE; dkim=pass header.i=@codeaurora.org header.s=default header.b=L+wme5cZ; 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 p188si4081605pga.206.2018.04.17.03.45.38; Tue, 17 Apr 2018 03:45:52 -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=@codeaurora.org header.s=default header.b=XX3YbZCE; dkim=pass header.i=@codeaurora.org header.s=default header.b=L+wme5cZ; 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 S1752684AbeDQKoZ (ORCPT + 99 others); Tue, 17 Apr 2018 06:44:25 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:54516 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752597AbeDQKoX (ORCPT ); Tue, 17 Apr 2018 06:44:23 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 378CA60F8F; Tue, 17 Apr 2018 10:44:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523961863; bh=9/EJC+bSi1pasJHhpSSC1KyWnAhQMCRIKJX55yLLTjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XX3YbZCEZlKNUcIV/Zb8amnu84RNErwb/aQgicWojriOoxvbW7U6pnGh+VB6MVgbB P5ezB+LiTwCnfoSDW4LF3fTjI40vHsZPbEzkgIz51zIdKe4/MSUyXgCfb29+fPUVF8 YqysS05S6TKsPgwv2VB76QL4Xgky3PlhAlNHwN9s= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from cpandya-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cpandya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id A868560F94; Tue, 17 Apr 2018 10:44:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523961862; bh=9/EJC+bSi1pasJHhpSSC1KyWnAhQMCRIKJX55yLLTjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L+wme5cZRcIK15PWlkzcOVUKlmAO3wcGT5S5FEIFxSKhSb2y3+Hf/rC/FFwnYMjm5 srL8Pan4kaV1M+cwx0VhbuyUqhHnsi8tCTZieCJWhsNIM4bsFoUmlUQ179bZ+cVS08 PphQBLgjZFJWvcy56w3NFb9kW9aOhgT7FDp+H+fY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A868560F94 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=cpandya@codeaurora.org From: Chintan Pandya To: vbabka@suse.cz, labbott@redhat.com, catalin.marinas@arm.com, hannes@cmpxchg.org, f.fainelli@gmail.com, xieyisheng1@huawei.com, ard.biesheuvel@linaro.org, richard.weiyang@gmail.com, byungchul.park@lge.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, khandual@linux.vnet.ibm.com, mhocko@kernel.org, Chintan Pandya Subject: [PATCH v2 2/2] mm: vmalloc: Pass proper vm_start into debugobjects Date: Tue, 17 Apr 2018 16:13:48 +0530 Message-Id: <1523961828-9485-3-git-send-email-cpandya@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1523961828-9485-1-git-send-email-cpandya@codeaurora.org> References: <1523961828-9485-1-git-send-email-cpandya@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Client can call vunmap with some intermediate 'addr' which may not be the start of the VM area. Entire unmap code works with vm->vm_start which is proper but debug object API is called with 'addr'. This could be a problem within debug objects. Pass proper start address into debug object API. Signed-off-by: Chintan Pandya --- mm/vmalloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 12d675c..033c918 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1124,15 +1124,15 @@ void vm_unmap_ram(const void *mem, unsigned int count) BUG_ON(addr > VMALLOC_END); BUG_ON(!PAGE_ALIGNED(addr)); - debug_check_no_locks_freed(mem, size); - if (likely(count <= VMAP_MAX_ALLOC)) { + debug_check_no_locks_freed(mem, size); vb_free(mem, size); return; } va = find_vmap_area(addr); BUG_ON(!va); + debug_check_no_locks_freed(va->va_start, (va->va_end - va->va_start)); free_unmap_vmap_area(va); } EXPORT_SYMBOL(vm_unmap_ram); @@ -1507,8 +1507,8 @@ static void __vunmap(const void *addr, int deallocate_pages) return; } - debug_check_no_locks_freed(addr, get_vm_area_size(area)); - debug_check_no_obj_freed(addr, get_vm_area_size(area)); + debug_check_no_locks_freed(area->addr, get_vm_area_size(area)); + debug_check_no_obj_freed(area->addr, get_vm_area_size(area)); remove_vm_area(addr); if (deallocate_pages) { -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project