From: Tero Roponen <tero.roponen@gmail.com>
To: linux-fsdevel@vger.kernel.org
Cc: viro@zeniv.linux.org.uk
Subject: Suspicious code in fs/dcache.c:d_delete
Date: Fri, 24 Feb 2012 19:03:16 +0200 (EET) [thread overview]
Message-ID: <alpine.LFD.2.02.1202241901340.4051@terrop> (raw)
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
reply other threads:[~2012-02-24 17:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.2.02.1202241901340.4051@terrop \
--to=tero.roponen@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).