Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Apparmor: Use d_is_positive/negative() rather than testing dentry->d_inode

Use d_is_positive(dentry) or d_is_negative(dentry) rather than testing
dentry->d_inode as the dentry may cover another layer that has an inode when
the top layer doesn't or may hold a 0,0 chardev that's actually a whiteout.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

authored by

David Howells and committed by
Al Viro
729b8a3d 7ac2856d

+1 -1
+1 -1
security/apparmor/path.c
··· 114 114 * security_path hooks as a deleted dentry except without an inode 115 115 * allocated. 116 116 */ 117 - if (d_unlinked(path->dentry) && path->dentry->d_inode && 117 + if (d_unlinked(path->dentry) && d_is_positive(path->dentry) && 118 118 !(flags & PATH_MEDIATE_DELETED)) { 119 119 error = -ENOENT; 120 120 goto out;