Merge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm
[firefly-linux-kernel-4.4.55.git] / fs / ext4 / crypto_fname.c
index 7dc4eb55913c445c5065646c99949b66d87979b5..847f919c84d9cc382889935baac16b6b8a1064e2 100644 (file)
@@ -19,7 +19,6 @@
 #include <linux/gfp.h>
 #include <linux/kernel.h>
 #include <linux/key.h>
-#include <linux/key.h>
 #include <linux/list.h>
 #include <linux/mempool.h>
 #include <linux/random.h>
@@ -329,6 +328,10 @@ int _ext4_fname_disk_to_usr(struct inode *inode,
                        return oname->len;
                }
        }
+       if (iname->len < EXT4_CRYPTO_BLOCK_SIZE) {
+               EXT4_ERROR_INODE(inode, "encrypted inode too small");
+               return -EUCLEAN;
+       }
        if (EXT4_I(inode)->i_crypt_info)
                return ext4_fname_decrypt(inode, iname, oname);