Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

udf: Limit file size to 4TB

UDF disk format supports in principle file sizes up to 1<<64-1. However
the file space (including holes) is described by a linked list of
extents, each of which can have at most 1GB. Thus the creation and
handling of extents gets unusably slow beyond certain point. Limit the
file size to 4TB to avoid locking up the kernel too easily.

Signed-off-by: Jan Kara <jack@suse.cz>

Jan Kara c2efd13a f386c802

+8 -1
+8 -1
fs/udf/super.c
··· 86 86 #define UDF_MAX_LVID_NESTING 1000 87 87 88 88 enum { UDF_MAX_LINKS = 0xffff }; 89 + /* 90 + * We limit filesize to 4TB. This is arbitrary as the on-disk format supports 91 + * more but because the file space is described by a linked list of extents, 92 + * each of which can have at most 1GB, the creation and handling of extents 93 + * gets unusably slow beyond certain point... 94 + */ 95 + #define UDF_MAX_FILESIZE (1ULL << 42) 89 96 90 97 /* These are the "meat" - everything else is stuffing */ 91 98 static int udf_fill_super(struct super_block *, void *, int); ··· 2264 2257 ret = -ENOMEM; 2265 2258 goto error_out; 2266 2259 } 2267 - sb->s_maxbytes = MAX_LFS_FILESIZE; 2260 + sb->s_maxbytes = UDF_MAX_FILESIZE; 2268 2261 sb->s_max_links = UDF_MAX_LINKS; 2269 2262 return 0; 2270 2263