This is a note to let you know that I've just added the patch titled f2fs crypto: avoid unneeded memory allocation in ->readdir to the 4.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: f2fs-crypto-avoid-unneeded-memory-allocation-in-readdir.patch and it can be found in the queue-4.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From e06f86e61d7a67fe6e826010f57aa39c674f4b1b Mon Sep 17 00:00:00 2001 From: Chao Yu <yuchao0@xxxxxxxxxx> Date: Sun, 28 Aug 2016 22:00:12 +0800 Subject: f2fs crypto: avoid unneeded memory allocation in ->readdir From: Chao Yu <yuchao0@xxxxxxxxxx> commit e06f86e61d7a67fe6e826010f57aa39c674f4b1b upstream. When decrypting dirents in ->readdir, fscrypt_fname_disk_to_usr won't change content of original encrypted dirent, we don't need to allocate additional buffer for storing mirror of it, so get rid of it. [This backport fixes a regression in 4.4-stable caused by commit 11a6e8f89521 ("f2fs: check memory boundary by insane namelen"), which depended on this missing commit. This bad backport broke f2fs encryption because it moved the incrementing of 'bit_pos' to earlier in f2fs_fill_dentries() without accounting for it being used in the encrypted dir case. This caused readdir() on encrypted directories to start failing. Tested with 'kvm-xfstests -c f2fs -g encrypt'.] Signed-off-by: Chao Yu <yuchao0@xxxxxxxxxx> Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/f2fs/dir.c | 7 ------- 1 file changed, 7 deletions(-) --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -820,15 +820,8 @@ bool f2fs_fill_dentries(struct dir_conte int save_len = fstr->len; int ret; - de_name.name = kmalloc(de_name.len, GFP_NOFS); - if (!de_name.name) - return false; - - memcpy(de_name.name, d->filename[bit_pos], de_name.len); - ret = f2fs_fname_disk_to_usr(d->inode, &de->hash_code, &de_name, fstr); - kfree(de_name.name); if (ret < 0) return true; Patches currently in stable-queue which might be from yuchao0@xxxxxxxxxx are queue-4.4/f2fs-crypto-avoid-unneeded-memory-allocation-in-readdir.patch