|
@@ -2047,14 +2047,29 @@ void udf_write_aext(struct inode *inode, struct extent_position *epos,
|
|
epos->offset += adsize;
|
|
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,
|
|
int8_t udf_next_aext(struct inode *inode, struct extent_position *epos,
|
|
struct kernel_lb_addr *eloc, uint32_t *elen, int inc)
|
|
struct kernel_lb_addr *eloc, uint32_t *elen, int inc)
|
|
{
|
|
{
|
|
int8_t etype;
|
|
int8_t etype;
|
|
|
|
+ unsigned int indirections = 0;
|
|
|
|
|
|
while ((etype = udf_current_aext(inode, epos, eloc, elen, inc)) ==
|
|
while ((etype = udf_current_aext(inode, epos, eloc, elen, inc)) ==
|
|
(EXT_NEXT_EXTENT_ALLOCDECS >> 30)) {
|
|
(EXT_NEXT_EXTENT_ALLOCDECS >> 30)) {
|
|
int block;
|
|
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->block = *eloc;
|
|
epos->offset = sizeof(struct allocExtDesc);
|
|
epos->offset = sizeof(struct allocExtDesc);
|
|
brelse(epos->bh);
|
|
brelse(epos->bh);
|