* [PATCH] udf: Check length of extended attributes and allocation descriptors
[not found] <55C847E2.2020807@huawei.com>
@ 2015-08-17 2:10 ` Zhang Zhen
2015-09-07 2:41 ` [PATCH for stable 3.10] " Zhang Zhen
0 siblings, 1 reply; 3+ messages in thread
From: Zhang Zhen @ 2015-08-17 2:10 UTC (permalink / raw)
To: stable; +Cc: Jan Kara, jslaby
commit 23b133bdc452aa441fcb9b82cbf6dd05cfd342d0 upstream.
Check length of extended attributes and allocation descriptors when
loading inodes from disk. Otherwise corrupted filesystems could confuse
the code and make the kernel oops.
Reported-by: Carl Henrik Lunde <chlunde@ping.uio.no>
Cc: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
[Jan and Jiri fixed it in 3.12 stable, i ported it to 3.10 stable,
replaced bs by inode->i_sb->s_blocksize]
Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
---
fs/udf/inode.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index aa02328..789814f 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1495,6 +1495,16 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
iinfo->i_checkpoint = le32_to_cpu(efe->checkpoint);
}
+ /*
+ * Sanity check length of allocation descriptors and extended attrs to
+ * avoid integer overflows
+ */
+ if (iinfo->i_lenEAttr > inode->i_sb->s_blocksize || iinfo->i_lenAlloc > inode->i_sb->s_blocksize)
+ return;
+ /* Now do exact checks */
+ if (udf_file_entry_alloc_offset(inode) + iinfo->i_lenAlloc > inode->i_sb->s_blocksize)
+ return;
+
switch (fe->icbTag.fileType) {
case ICBTAG_FILE_TYPE_DIRECTORY:
inode->i_op = &udf_dir_inode_operations;
--
1.8.3.4
.
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH for stable 3.10] udf: Check length of extended attributes and allocation descriptors
2015-08-17 2:10 ` [PATCH] udf: Check length of extended attributes and allocation descriptors Zhang Zhen
@ 2015-09-07 2:41 ` Zhang Zhen
2015-09-07 3:09 ` Zhang Zhen
0 siblings, 1 reply; 3+ messages in thread
From: Zhang Zhen @ 2015-09-07 2:41 UTC (permalink / raw)
To: stable; +Cc: Greg KH
commit 23b133bdc452aa441fcb9b82cbf6dd05cfd342d0 upstream.
Check length of extended attributes and allocation descriptors when
loading inodes from disk. Otherwise corrupted filesystems could confuse
the code and make the kernel oops.
Reported-by: Carl Henrik Lunde <chlunde@ping.uio.no>
Cc: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
[Jan and Jiri fixed it in 3.12 stable, i ported it to 3.10 stable,
replaced bs by inode->i_sb->s_blocksize]
Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
---
fs/udf/inode.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index aa02328..789814f 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1495,6 +1495,16 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
iinfo->i_checkpoint = le32_to_cpu(efe->checkpoint);
}
+ /*
+ * Sanity check length of allocation descriptors and extended attrs to
+ * avoid integer overflows
+ */
+ if (iinfo->i_lenEAttr > inode->i_sb->s_blocksize || iinfo->i_lenAlloc > inode->i_sb->s_blocksize)
+ return;
+ /* Now do exact checks */
+ if (udf_file_entry_alloc_offset(inode) + iinfo->i_lenAlloc > inode->i_sb->s_blocksize)
+ return;
+
switch (fe->icbTag.fileType) {
case ICBTAG_FILE_TYPE_DIRECTORY:
inode->i_op = &udf_dir_inode_operations;
--
1.8.3.4
.
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH for stable 3.10] udf: Check length of extended attributes and allocation descriptors
2015-09-07 2:41 ` [PATCH for stable 3.10] " Zhang Zhen
@ 2015-09-07 3:09 ` Zhang Zhen
0 siblings, 0 replies; 3+ messages in thread
From: Zhang Zhen @ 2015-09-07 3:09 UTC (permalink / raw)
To: stable; +Cc: Greg KH
From: Jan Kara <jack@suse.cz>
commit 23b133bdc452aa441fcb9b82cbf6dd05cfd342d0 upstream.
Check length of extended attributes and allocation descriptors when
loading inodes from disk. Otherwise corrupted filesystems could confuse
the code and make the kernel oops.
Reported-by: Carl Henrik Lunde <chlunde@ping.uio.no>
Cc: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
[Jan and Jiri fixed it in 3.12 stable, i ported it to 3.10 stable,
replaced bs by inode->i_sb->s_blocksize]
Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
---
fs/udf/inode.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index aa02328..789814f 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1495,6 +1495,16 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
iinfo->i_checkpoint = le32_to_cpu(efe->checkpoint);
}
+ /*
+ * Sanity check length of allocation descriptors and extended attrs to
+ * avoid integer overflows
+ */
+ if (iinfo->i_lenEAttr > inode->i_sb->s_blocksize || iinfo->i_lenAlloc > inode->i_sb->s_blocksize)
+ return;
+ /* Now do exact checks */
+ if (udf_file_entry_alloc_offset(inode) + iinfo->i_lenAlloc > inode->i_sb->s_blocksize)
+ return;
+
switch (fe->icbTag.fileType) {
case ICBTAG_FILE_TYPE_DIRECTORY:
inode->i_op = &udf_dir_inode_operations;
--
1.8.3.4
.
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-09-07 3:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <55C847E2.2020807@huawei.com>
2015-08-17 2:10 ` [PATCH] udf: Check length of extended attributes and allocation descriptors Zhang Zhen
2015-09-07 2:41 ` [PATCH for stable 3.10] " Zhang Zhen
2015-09-07 3:09 ` Zhang Zhen
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).