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  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]
Date:	Mon, 13 Oct 2014 00:56:11 +0100
From:	Anton Altaparmakov <>
To:	Al Viro <>
Cc:	Christoph Hellwig <>,,
Subject: Re: WTF is d_add_ci() doing with negative dentries?

Hi Al,

On 12 Oct 2014, at 23:18, Al Viro <> wrote:
> 	AFAICS, if d_add_ci() ever finds a negative hashed dentry for
> exact name, it's already buggered.  Because right *before* that
> d_add_ci() lookup for exact name would've turned valid negative.

Christoph copied d_add_ci() from code I wrote for NTFS so you can blame me for it.  (-;

Do you mean that given the exact name exists on disk, there cannot be a negative dentry for it in memory, i.e. there would either be no dentry in memory or it would be a positive dentry in memory?

If so then that makes sense, yes.

I am just wondering whether there might be error conditions in which we might end up with a (perhaps invalid) negative dentry in memory which could be found here?  Probably not a problem especially now that d_invalidate() cannot fail any more.

Is it worth adding a BUG_ON(!found->d_inode); to ensure sanity/catch bugs?

> IOW, the whole thing ought to be
>        found = d_hash_and_lookup(dentry->d_parent, name);
> 	if (found) {
> 		iput(inode);
> 		return found;
> 	}
> 	new = d_alloc(dentry->d_parent, name);
> 	if (!new) {
> 		iput(inode);
> 		return ERR_PTR(-ENOMEM);
> 	}
> 	found = d_splice_alias(inode, new);
> 	if (found) {
> 		dput(new);
> 		return found;
> 	}
> 	return new;
> Moreover, it might very well be better to pass dentry->d_parent instead
> of dentry...  Objections?

Yes, that bit makes perfect sense given we only ever use dentry->d_parent.

Best regards,

Anton Altaparmakov <aia21 at> (replace at with @)
University of Cambridge Information Services, Roger Needham Building
7 JJ Thomson Avenue, Cambridge, CB3 0RB, UK

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists