Skip to content

Commit

Permalink
ext4: Avoid printk floods in the face of directory corruption
Browse files Browse the repository at this point in the history
Note: some people thinks this represents a security bug, since it
might make the system go away while it is printing a large number of
console messages, especially if a serial console is involved.  Hence,
it has been assigned CVE-2008-3528, but it requires that the attacker
either has physical access to your machine to insert a USB disk with a
corrupted filesystem image (at which point why not just hit the power
button), or is otherwise able to convince the system administrator to
mount an arbitrary filesystem image (at which point why not just
include a setuid shell or world-writable hard disk device file or some
such).  Me, I think they're just being silly. --tytso

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: linux-ext4@vger.kernel.org
Cc: Eugene Teo <eugeneteo@kernel.sg>
  • Loading branch information
Eric Sandeen authored and Theodore Ts'o committed Oct 9, 2008
1 parent cf17fea commit 9d9f177
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions fs/ext4/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ static int ext4_readdir(struct file *filp,
int err;
struct inode *inode = filp->f_path.dentry->d_inode;
int ret = 0;
int dir_has_error = 0;

sb = inode->i_sb;

Expand Down Expand Up @@ -148,9 +149,13 @@ static int ext4_readdir(struct file *filp,
* of recovering data when there's a bad sector
*/
if (!bh) {
ext4_error(sb, "ext4_readdir",
"directory #%lu contains a hole at offset %lu",
inode->i_ino, (unsigned long)filp->f_pos);
if (!dir_has_error) {
ext4_error(sb, __func__, "directory #%lu "
"contains a hole at offset %Lu",
inode->i_ino,
(unsigned long long) filp->f_pos);
dir_has_error = 1;
}
/* corrupt size? Maybe no more blocks to read */
if (filp->f_pos > inode->i_blocks << 9)
break;
Expand Down

0 comments on commit 9d9f177

Please sign in to comment.