merge missing updates to squashfs lzma support from 2.6.30 to 2.6.31
authorFelix Fietkau <nbd@openwrt.org>
Wed, 23 Sep 2009 13:32:13 +0000 (13:32 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 23 Sep 2009 13:32:13 +0000 (13:32 +0000)
SVN-Revision: 17686

target/linux/generic-2.6/patches-2.6.31/053-squashfs_lzma.patch

index c07239b..2725f06 100644 (file)
@@ -47,7 +47,7 @@
        __le32                  s_magic;
 --- a/fs/squashfs/super.c
 +++ b/fs/squashfs/super.c
-@@ -48,13 +48,65 @@
+@@ -48,13 +48,76 @@
  #include "squashfs.h"
  
  
@@ -81,7 +81,7 @@
 +              crypto_free_pcomp(msblk->tfm);
 +      }
 +#endif
++
 +      return err;
 +}
 +
 +      int err = -EOPNOTSUPP;
 +
 +#ifdef CONFIG_SQUASHFS_SUPPORT_LZMA
++      struct {
++              struct nlattr nla;
++              int val;
++      } params = {
++              .nla = {
++                      .nla_len        = nla_attr_size(sizeof(int)),
++                      .nla_type       = UNLZMA_DECOMP_OUT_BUFFERS,
++              },
++              .val = (msblk->block_size / PAGE_CACHE_SIZE) + 1
++      };
 +      msblk->tfm = crypto_alloc_pcomp("lzma", 0,
 +                                      CRYPTO_ALG_ASYNC);
 +      if (IS_ERR(msblk->tfm)) {
 +              return PTR_ERR(msblk->tfm);
 +      }
 +
-+      err = crypto_decompress_setup(msblk->tfm, NULL, 0);
++      err = crypto_decompress_setup(msblk->tfm, &params, sizeof(params));
 +      if (err) {
 +              ERROR("Failed to set up decompression parameters\n");
 +              crypto_free_pcomp(msblk->tfm);
  {
        if (major < SQUASHFS_MAJOR) {
                ERROR("Major/Minor mismatch, older Squashfs %d.%d "
-@@ -67,9 +119,6 @@ static int supported_squashfs_filesystem
+@@ -67,9 +130,6 @@ static int supported_squashfs_filesystem
                return -EINVAL;
        }
  
        return 0;
  }
  
-@@ -84,16 +133,6 @@ static int squashfs_fill_super(struct su
+@@ -84,16 +144,6 @@ static int squashfs_fill_super(struct su
        unsigned short flags;
        unsigned int fragments;
        u64 lookup_table_start;
        int err;
  
        TRACE("Entered squashfs_fill_superblock\n");
-@@ -105,21 +144,6 @@ static int squashfs_fill_super(struct su
+@@ -105,21 +155,6 @@ static int squashfs_fill_super(struct su
        }
        msblk = sb->s_fs_info;
  
        sblk = kzalloc(sizeof(*sblk), GFP_KERNEL);
        if (sblk == NULL) {
                ERROR("Failed to allocate squashfs_super_block\n");
-@@ -159,8 +183,21 @@ static int squashfs_fill_super(struct su
+@@ -157,10 +192,28 @@ static int squashfs_fill_super(struct su
+               goto failed_mount;
+       }
  
++      /* Check block size for sanity */
++      msblk->block_size = le32_to_cpu(sblk->block_size);
++      if (msblk->block_size > SQUASHFS_FILE_MAX_SIZE)
++              goto failed_mount;
++
        /* Check the MAJOR & MINOR versions and compression type */
        err = supported_squashfs_filesystem(le16_to_cpu(sblk->s_major),
 -                      le16_to_cpu(sblk->s_minor),
        if (err < 0)
                goto failed_mount;
  
-@@ -316,21 +353,16 @@ allocate_root:
+@@ -180,11 +233,6 @@ static int squashfs_fill_super(struct su
+                       i_size_read(sb->s_bdev->bd_inode))
+               goto failed_mount;
+-      /* Check block size for sanity */
+-      msblk->block_size = le32_to_cpu(sblk->block_size);
+-      if (msblk->block_size > SQUASHFS_FILE_MAX_SIZE)
+-              goto failed_mount;
+-
+       /*
+        * Check the system page size is not larger than the filesystem
+        * block size (by default 128K).  This is currently not supported.
+@@ -316,21 +364,16 @@ allocate_root:
        return 0;
  
  failed_mount: