From 78027a0162b6f91d590826847330bd9a5fb96ae5 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 15 Sep 2016 13:17:29 -0400 Subject: [PATCH] add patch fix-memory-leak-when-symlink-decryption-fails --- fix-memory-leak-when-symlink-decryption-fails | 36 +++++++++++++++++++++++++++ series | 1 + timestamps | 6 ++--- 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 fix-memory-leak-when-symlink-decryption-fails diff --git a/fix-memory-leak-when-symlink-decryption-fails b/fix-memory-leak-when-symlink-decryption-fails new file mode 100644 index 00000000..2dc3ee1a --- /dev/null +++ b/fix-memory-leak-when-symlink-decryption-fails @@ -0,0 +1,36 @@ +ext4: fix memory leak when symlink decryption fails + +From: Eric Biggers + +This bug was introduced in v4.8-rc1. + +Signed-off-by: Eric Biggers +Signed-off-by: Theodore Ts'o +Cc: stable@vger.kernel.org +--- + fs/ext4/symlink.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/fs/ext4/symlink.c b/fs/ext4/symlink.c +index 4d83d9e..04a7850 100644 +--- a/fs/ext4/symlink.c ++++ b/fs/ext4/symlink.c +@@ -65,13 +65,12 @@ static const char *ext4_encrypted_get_link(struct dentry *dentry, + res = fscrypt_fname_alloc_buffer(inode, cstr.len, &pstr); + if (res) + goto errout; ++ paddr = pstr.name; + + res = fscrypt_fname_disk_to_usr(inode, 0, 0, &cstr, &pstr); + if (res < 0) + goto errout; + +- paddr = pstr.name; +- + /* Null-terminate the name */ + if (res <= pstr.len) + paddr[res] = '\0'; +-- +2.8.0.rc3.226.g39d4020 + + diff --git a/series b/series index b6413e29..e5263175 100644 --- a/series +++ b/series @@ -22,6 +22,7 @@ remove-unneeded-test-in-ext4_alloc_file_blocks create-EXT4_MAX_BLOCKS-macro remove-unused-definition move-more-common-code-into-journal_init_common +fix-memory-leak-when-symlink-decryption-fails ########################################## # unstable patches diff --git a/timestamps b/timestamps index a7f5c00a..bd7be20b 100755 --- a/timestamps +++ b/timestamps @@ -59,8 +59,8 @@ touch -d @1473953992 fix-memory-leak-in-ext4_insert_range touch -d @1473954727 remove-unneeded-test-in-ext4_alloc_file_blocks touch -d @1473954901 create-EXT4_MAX_BLOCKS-macro touch -d @1473955127 remove-unused-definition -touch -d @1473955324 series touch -d @1473955352 move-more-common-code-into-journal_init_common -touch -d @1473955376 status touch -d @1473959593 fix-memory-leak-when-symlink-decryption-fails -touch -d @1473959679 timestamps +touch -d @1473959751 series +touch -d @1473959759 status +touch -d @1473959841 timestamps -- 2.11.4.GIT