Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp107750imj; Wed, 13 Feb 2019 05:31:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IY/DVxj1xlz3zwUsc+2BcU8i8kKwLAWl3yupAp29n44wWp1cuDy0/WkILzeVZRyNMgMo4ug X-Received: by 2002:a17:902:5ac9:: with SMTP id g9mr543857plm.205.1550064704518; Wed, 13 Feb 2019 05:31:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550064704; cv=none; d=google.com; s=arc-20160816; b=XKVFJ0vlxyRLEZj+B2wkNHTVHxut/VUbuSHeMEDZcLi/KgjZx7poF5bEKrC9RSW7y1 ii4gWFZnESacArgAc+MDPUMr5/hHi6zoGUlgI+NDBRTFbdOB6qAHYPuqJKy7tD6INgNU PzXdrdBQGSAkelgxQejXJzwzYCRGbYDe6GkoE1lW1tfyGay3+ftY4sMe/two5jpT8xIu NdCaxE2T2O6R6E8AzDv/QvTtrJ8YkDZBLTtzTRLs1l1XylaT155fgaem5yABy8b37SMw 9MOaHMYaTAd+yRzugpdB13RShzFuQPFiabSDKiVyslpBd54IhSW5V34WzV9tQDxG+/UA VZrw== 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=ecJK2SRY5JC/v5bz8RlomH5Zy2nRGuuv9UZPJmlJPZ0=; b=BTerg59fo3tAOMSbCpzaWeIs2wAGvSuhXSRUMNcJO2IH4denUpAD0l6/3QlRgjZUAS +mJZGKEnQSPvfrDP62TmuLk91jEIk6z2KT1cfkawvxNmq0+Au84dsEHdazj986yOdYsq ogJ1zKKEsPBaVwJ+ZsLEHHVfUhqYvqcrCoUGcPsj975InMRo9YIHDV9esnNkC06uTovz QYizR4+5f8Dgfaxow2ec+0GNLWNLKNLrZ94Q0s8yDn8Z5uU3iWHph76rqEtlBNdMO5Z7 s7WtHG/6pHAGcBdZVfyOqq7zPjBqSp1EyA5IobiNe/LnzJ0OWjDlDQ2yTGo2TReLeBcf RV3Q== 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 u2si15516579pgo.544.2019.02.13.05.31.12; Wed, 13 Feb 2019 05:31:44 -0800 (PST) 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 S1730558AbfBMJ2Q (ORCPT + 99 others); Wed, 13 Feb 2019 04:28:16 -0500 Received: from smtp3-g21.free.fr ([212.27.42.3]:47748 "EHLO smtp3-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725838AbfBMJ2Q (ORCPT ); Wed, 13 Feb 2019 04:28:16 -0500 Received: from [192.168.108.68] (unknown [213.36.7.13]) (Authenticated sender: marc.w.gonzalez) by smtp3-g21.free.fr (Postfix) with ESMTPSA id 9F52B13F89C; Wed, 13 Feb 2019 10:27:48 +0100 (CET) Subject: Re: [RESEND PATCH v2] of: fix kmemleak crash caused by imbalance in early memory reservation To: Mike Rapoport Cc: Rob Herring , Andrew Morton , Stephen Rothwell , Frank Rowand , Marek Szyprowski , Catalin Marinas , Prateek Patel , DT , LKML , stable References: <3c886941-bf9d-f040-b568-ee7a8eba9a04@free.fr> <20190123055414.GA4747@rapoport-lnx> <78f4ea8a-996d-038e-9e33-5ff02fa2c43f@samsung.com> <20190123123143.GE4747@rapoport-lnx> <4b8f82c4-7f8f-b814-c1ec-9902e43963f6@free.fr> <617e0d57-342d-4162-bd21-ece18e481d87@free.fr> <20190213085028.6199594b@canb.auug.org.au> <20190213065734.GA14425@rapoport-lnx> From: Marc Gonzalez Message-ID: <5c9184f3-71c1-7875-52f7-616d299a9549@free.fr> Date: Wed, 13 Feb 2019 10:27:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190213065734.GA14425@rapoport-lnx> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/02/2019 07:57, Mike Rapoport wrote: > Below is the version vs. current mmotm. > > From 9ea6dceb46067d4f1cbbdbec1189c8496aa0a4bc Mon Sep 17 00:00:00 2001 > From: Mike Rapoport > Date: Mon, 4 Feb 2019 15:37:21 +0100 > Subject: [PATCH] of: fix kmemleak crash caused by imbalance in early memory reservation Out of curiosity, why don't you send as a proper v3? > Marc Gonzalez reported the following kmemleak crash: > > [...] > > The crash happens when a no-map area is allocated in > early_init_dt_alloc_reserved_memory_arch(). The allocated region is > registered with kmemleak, but it is then removed from memblock using > memblock_remove() that is not kmemleak-aware. > > Replacing __memblock_alloc_base() with memblock_find_in_range() Nit: in this new version, you're replacing memblock_phys_alloc_range() with memblock_find_in_range() so I don't know if the comment still applies. > makes sure that the allocated memory is not added to kmemleak and then > memblock_remove()'ing this memory is safe. > > As a bonus, since memblock_find_in_range() ensures the allocation in the > specified range, the bounds check can be removed. > > Cc: stable@vger.kernel.org # 3.15+ > Fixes: 3f0c820664483 ("drivers: of: add initialization code for dynamic reserved memory") > Acked-by: Marek Szyprowski > Acked-by: Prateek Patel > Tested-by: Marc Gonzalez > Signed-off-by: Mike Rapoport