* Suspicious code in fs/dcache.c:d_delete
@ 2012-02-24 17:03 Tero Roponen
0 siblings, 0 replies; only message in thread
From: Tero Roponen @ 2012-02-24 17:03 UTC (permalink / raw)
To: linux-fsdevel; +Cc: viro
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-02-24 17:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-24 17:03 Suspicious code in fs/dcache.c:d_delete Tero Roponen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).