summaryrefslogtreecommitdiff
path: root/fs/udf/inode.c
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2016-03-29 13:02:23 -0700
committerStefan Agner <stefan.agner@toradex.com>2016-03-29 13:02:23 -0700
commit1df133c0db64d633bbb9b238aa0e1588e2c5e7d6 (patch)
treec68d76907c523e81b5d0e8a924728f9e1aed1844 /fs/udf/inode.c
parent2b7d39d1a28cb478627fc22fdc8dd77ed89ffe92 (diff)
parent62e21959dc6f25c5fce0c1a0934e4a9d982bf99b (diff)
Merge tag 'v4.4.5' into toradex_vf_4.4-next
This is the 4.4.5 stable release
Diffstat (limited to 'fs/udf/inode.c')
-rw-r--r--fs/udf/inode.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 8d0b3ade0ff0..566df9b5a6cb 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -2047,14 +2047,29 @@ void udf_write_aext(struct inode *inode, struct extent_position *epos,
epos->offset += adsize;
}
+/*
+ * Only 1 indirect extent in a row really makes sense but allow upto 16 in case
+ * someone does some weird stuff.
+ */
+#define UDF_MAX_INDIR_EXTS 16
+
int8_t udf_next_aext(struct inode *inode, struct extent_position *epos,
struct kernel_lb_addr *eloc, uint32_t *elen, int inc)
{
int8_t etype;
+ unsigned int indirections = 0;
while ((etype = udf_current_aext(inode, epos, eloc, elen, inc)) ==
(EXT_NEXT_EXTENT_ALLOCDECS >> 30)) {
int block;
+
+ if (++indirections > UDF_MAX_INDIR_EXTS) {
+ udf_err(inode->i_sb,
+ "too many indirect extents in inode %lu\n",
+ inode->i_ino);
+ return -1;
+ }
+
epos->block = *eloc;
epos->offset = sizeof(struct allocExtDesc);
brelse(epos->bh);