From: Dan Carpenter <error27@gmail.com>
To: aneesh.kumar@linux.vnet.ibm.com
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu, adilger@sun.com
Subject: [patch] Null dereference in ext4_ext_migrate()
Date: Tue, 3 Feb 2009 10:49:22 +0300 (EAT) [thread overview]
Message-ID: <alpine.DEB.2.00.0901302346430.12904@bikeee> (raw)
There is a potential null dereference of tmp_inode.
The patch also removes an unnecessary check for whether tmp_inode is null.
This was found through a code checker (http://repo.or.cz/w/smatch.git/).
It looks like you might be able to trigger the error by trying to migrate
a readonly file system. I have only compile tested though, sorry.
regards,
dan carpenter
Signed-off-by: Dan Carpenter <error27@gmail.com>
--- orig/fs/ext4/migrate.c 2009-01-30 23:55:33.000000000 +0300
+++ devel/fs/ext4/migrate.c 2009-01-30 23:57:14.000000000 +0300
@@ -481,7 +481,7 @@
+ 1);
if (IS_ERR(handle)) {
retval = PTR_ERR(handle);
- goto err_out;
+ return retval;
}
tmp_inode = ext4_new_inode(handle,
inode->i_sb->s_root->d_inode,
@@ -489,8 +489,7 @@
if (IS_ERR(tmp_inode)) {
retval = -ENOMEM;
ext4_journal_stop(handle);
- tmp_inode = NULL;
- goto err_out;
+ return retval;
}
i_size_write(tmp_inode, i_size_read(inode));
/*
@@ -618,8 +617,7 @@
ext4_journal_stop(handle);
- if (tmp_inode)
- iput(tmp_inode);
+ iput(tmp_inode);
return retval;
}
next reply other threads:[~2009-02-03 7:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-03 7:49 Dan Carpenter [this message]
2009-02-16 1:06 ` [patch] Null dereference in ext4_ext_migrate() Theodore Tso
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.DEB.2.00.0901302346430.12904@bikeee \
--to=error27@gmail.com \
--cc=adilger@sun.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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