Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4153255pxk; Tue, 8 Sep 2020 12:03:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8xDPDQEsBjvyekHr+iV5rsvzxhNP0daiJbFYpFpWPmne1BtuJbQNiM8LHDh1sUiQ2zp0d X-Received: by 2002:aa7:ce15:: with SMTP id d21mr456931edv.284.1599591786887; Tue, 08 Sep 2020 12:03:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599591786; cv=none; d=google.com; s=arc-20160816; b=Xro66H4rfTeZXw2J3TfkpR0Tx5iAloO1SfagwdksL1RgpaRLZqLI4PKJHyFrauf9Nb sKLXhmeyrgRPGMMCP5L5cjkljDIjw/nVKvPFtsujSF7DTTI/Lr3RX/t2JgiREvRcdIhC dIC/1ZT591zlyGUFBrJW9j+BRWb2Z6EvsMKFz+zrnVhfva3P+cmkoBckG8SjQh8RBmyT ZUUPIqAy2mUglncX9PudFYfIUHyPOXOYxwbY7yR8ZooNlWwCwk1gEK/XKEDJbRE0SUJL fBwE3qdIzHUhM9DPBbJpZeDpoJT0r12Fa1jtShX8GSAWDs+vWcsAMbr3dCwkYpv/0UWI +F+w== 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=2JP8FLEYTdBW1QWj/d4FCVMh7bn2n0/CZReB/B9UBrs=; b=lC9jJyhAtQPvmP0szSY9yc+r3i673R8GXwK4JYooGzQWy/WtnDYOxu1WQahq3e8VKh q1MK/UAOlXhz4En9gFcdXZsz6R1nNEikvG7TYOTTzmR8P5hD3esHFtJoZVR9NBFuFjYU IdWonI2KmBqLAj4FItjb7grGcYN25W1AJ0snUy/pMf6dXGv7lX3AacXpmLLViw4KikiW a7OZQXIxcdPHyDqrzx+eRwfv1LjFs1HgrAQbBXG40GKyZ15vlt8c13Osktxsyu4ilX9z rZvtcNKs6FjO19z/QM/yXladf+eBu4t/b4YF/TaPToWHKBSX3e1v04rvm/G9ezMrtzba rudg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p22si850516ejm.511.2020.09.08.12.02.43; Tue, 08 Sep 2020 12:03:06 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731539AbgIHTBc (ORCPT + 99 others); Tue, 8 Sep 2020 15:01:32 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:54670 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731307AbgIHQIC (ORCPT ); Tue, 8 Sep 2020 12:08:02 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: dafna) with ESMTPSA id 72A6129912E Subject: Re: [PATCH] regmap: debugfs: potentially duplicate the name string of the config To: Mark Brown Cc: linux-kernel@vger.kernel.org, rafael@kernel.org, gregkh@linuxfoundation.org, enric.balletbo@collabora.com, kernel@collabora.com, dafna3@gmail.com References: <20200908152859.26279-1-dafna.hirschfeld@collabora.com> <20200908153559.GF5551@sirena.org.uk> From: Dafna Hirschfeld Message-ID: <455274f0-718c-9247-da29-6122687720eb@collabora.com> Date: Tue, 8 Sep 2020 18:07:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200908153559.GF5551@sirena.org.uk> Content-Type: text/plain; charset=windows-1252; format=flowed 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 Hi, thank you for the fast review, Am 08.09.20 um 17:35 schrieb Mark Brown: > On Tue, Sep 08, 2020 at 05:28:59PM +0200, Dafna Hirschfeld wrote: >> In function regmap_debugfs_init the name of the regmap_config is assigned >> in a node of regmap_debugfs_early_list to be used later after regmap >> is initialized. It is unknown how and when the name is allocated and freed. >> Therefore the name should be copied to the node using 'kstrdup_const'. > > It does not follow that the name should be copied, it equally follows > (and is expected by the API given that the common case is that the name > is a static string assigned at build time) that the caller should not > free the string while the regmap is active. I see that the same copy is already done in function __regmap_init in drivers/base/regmap/regmap.c added in patch 8253bb3f82554 "regmap: potentially duplicate the name string stored in regmap" so I thought I'll do the same. > >> This fixes an error >> "debugfs: Directory 'dummy-' with parent 'regmap' already present!" >> where the name was freed in function of_syscon_register before >> it was accessed. > > Fix the caller. It is *very* much unclear to me why a syscon would be > assigning a name for a regmap it creates in the first place. I'll have a deeper look. Thanks, Dafna >