Suspicious code in fs/dcache.c:d_delete

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

 



While reading the code in fs directory I found some questionable
code:

void d_delete(struct dentry * dentry)
{
	...

	inode = dentry->d_inode;
	isdir = S_ISDIR(inode->i_mode);
	if (dentry->d_count == 1) {
		if (inode && !spin_trylock(&inode->i_lock)) {
			spin_unlock(&dentry->d_lock);

	...
}

If inode can become NULL here then dereferencing it without
checking in S_ISDIR(inode->i_mode) is wrong. If it cannot be NULL
then testing it in 'if (inode && !spin_...)' is not needed.

-- 
Tero Roponen
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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