diff options
-rw-r--r-- | fs/ufs/super.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index 261a1c2f22dd..e1c1fc5ee239 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
@@ -636,6 +636,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | |||
636 | unsigned block_size, super_block_size; | 636 | unsigned block_size, super_block_size; |
637 | unsigned flags; | 637 | unsigned flags; |
638 | unsigned super_block_offset; | 638 | unsigned super_block_offset; |
639 | unsigned maxsymlen; | ||
639 | int ret = -EINVAL; | 640 | int ret = -EINVAL; |
640 | 641 | ||
641 | uspi = NULL; | 642 | uspi = NULL; |
@@ -1069,6 +1070,16 @@ magic_found: | |||
1069 | uspi->s_maxsymlinklen = | 1070 | uspi->s_maxsymlinklen = |
1070 | fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_maxsymlinklen); | 1071 | fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_maxsymlinklen); |
1071 | 1072 | ||
1073 | if (uspi->fs_magic == UFS2_MAGIC) | ||
1074 | maxsymlen = 2 * 4 * (UFS_NDADDR + UFS_NINDIR); | ||
1075 | else | ||
1076 | maxsymlen = 4 * (UFS_NDADDR + UFS_NINDIR); | ||
1077 | if (uspi->s_maxsymlinklen > maxsymlen) { | ||
1078 | ufs_warning(sb, __func__, "ufs_read_super: excessive maximum " | ||
1079 | "fast symlink size (%u)\n", uspi->s_maxsymlinklen); | ||
1080 | uspi->s_maxsymlinklen = maxsymlen; | ||
1081 | } | ||
1082 | |||
1072 | inode = ufs_iget(sb, UFS_ROOTINO); | 1083 | inode = ufs_iget(sb, UFS_ROOTINO); |
1073 | if (IS_ERR(inode)) { | 1084 | if (IS_ERR(inode)) { |
1074 | ret = PTR_ERR(inode); | 1085 | ret = PTR_ERR(inode); |