Re: [PATCH 4/6] fs: dcache locking for exlusion between overlayfs, casefolding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 20, 2025 at 04:25:36PM +0100, Al Viro wrote:
> On Tue, May 20, 2025 at 01:15:56AM -0400, Kent Overstreet wrote:
> 
> > +int d_casefold_enable(struct dentry *dentry, struct d_casefold_enable *e)
> > +{
> > +	struct dentry *root = dentry->d_sb->s_root;
> > +	int ret = 0;
> > +
> > +	guard(mutex)(&no_casefold_dentries_lock);
> > +
> > +	for (struct dentry *i = dentry;
> > +	     i && i->d_inode->i_flags & S_NO_CASEFOLD;
> > +	     i = i != root ? i->d_parent : NULL) {
> > +		ret = darray_push(&e->refs, i);
> > +		if (ret)
> > +			goto err;
> > +
> > +		ret = no_casefold_dentry_get(i, ref_casefold_enable);
> 
> 	Beyond being fucking ugly, this is outright broken.  Lose
> the timeslice (e.g. on allocation in that thing), and there's
> nothing to prevent your 'i' from pointing to freed memory.

I was under the impression that dentries couldn't be freed while a child
is pinned, and we have a dget() on the start of the chain.

But no, rename would break that, of course.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux