lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <A5E6C26210115B9B+ZbtsVxPxJ4WCFtdp@centos8>
Date: Thu, 1 Feb 2024 18:03:03 +0800
From: Dawei Li <dawei.li@...ngroup.cn>
To: Rob Herring <robh@...nel.org>
Cc: frowand.list@...il.com, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, set_pte_at@...look.com
Subject: Re: [PATCH 2/2] of: Implment cache update operation on device node
 attach

Hi Rob,

Thanks for review.

On Wed, Jan 31, 2024 at 03:12:27PM -0600, Rob Herring wrote:
> On Tue, Jan 30, 2024 at 06:52:36PM +0800, Dawei Li wrote:
> > Use implemented __of_phandle_update_cache to update phandle cache on
> > device node attachment.
> > 
> > While at it, make explicit assertion on locking dependency for
> > __of_phandle_cache_inv_entry.
> 
> 'While at it' is a red flag for should be a separate commit.

Agreed. It should be in a separate commit.

Thanks,

    Dawei

> 
> > 
> > Signed-off-by: Dawei Li <dawei.li@...ngroup.cn>
> > ---
> >  drivers/of/base.c    | 6 ++++--
> >  drivers/of/dynamic.c | 2 ++
> >  2 files changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/of/base.c b/drivers/of/base.c
> > index 8b7da27835eb..44e542b566e1 100644
> > --- a/drivers/of/base.c
> > +++ b/drivers/of/base.c
> > @@ -153,6 +153,8 @@ void __of_phandle_cache_inv_entry(phandle handle)
> >  	u32 handle_hash;
> >  	struct device_node *np;
> >  
> > +	lockdep_assert_held(&devtree_lock);
> > +
> >  	if (!handle)
> >  		return;
> >  
> > @@ -195,8 +197,8 @@ void __init of_core_init(void)
> >  	}
> >  	for_each_of_allnodes(np) {
> >  		__of_attach_node_sysfs(np);
> > -		if (np->phandle && !phandle_cache[of_phandle_cache_hash(np->phandle)])
> > -			phandle_cache[of_phandle_cache_hash(np->phandle)] = np;
> > +
> > +		__of_phandle_update_cache(np, false);
> >  	}
> >  	mutex_unlock(&of_mutex);
> >  
> > diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
> > index 3bf27052832f..a68bf58f2c24 100644
> > --- a/drivers/of/dynamic.c
> > +++ b/drivers/of/dynamic.c
> > @@ -219,6 +219,8 @@ static void __of_attach_node(struct device_node *np)
> >  			np->phandle = 0;
> >  	}
> >  
> > +	__of_phandle_update_cache(np, true);
> > +
> >  	np->child = NULL;
> >  	np->sibling = np->parent->child;
> >  	np->parent->child = np;
> > -- 
> > 2.27.0
> > 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ