mirror of
https://github.com/brain-hackers/linux-brain.git
synced 2024-06-09 15:26:21 +09:00
udf: Detect incorrect directory size
commit fa65653e57
upstream.
Detect when a directory entry is (possibly partially) beyond directory
size and return EIO in that case since it means the filesystem is
corrupted. Otherwise directory operations can further corrupt the
directory and possibly also oops the kernel.
CC: Anatoly Trosinenko <anatoly.trosinenko@gmail.com>
CC: stable@vger.kernel.org
Reported-and-tested-by: Anatoly Trosinenko <anatoly.trosinenko@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3cac26f2a2
commit
2a1b1234d0
|
@ -150,6 +150,9 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
|
|||
sizeof(struct fileIdentDesc));
|
||||
}
|
||||
}
|
||||
/* Got last entry outside of dir size - fs is corrupted! */
|
||||
if (*nf_pos > dir->i_size)
|
||||
return NULL;
|
||||
return fi;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user