diff options
author | Kirill Tkhai <ktkhai@virtuozzo.com> | 2016-09-07 10:03:16 +0300 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-09-07 01:19:12 -0700 |
commit | 92d978db31c94fdfbebbb6710dc4dc53ed01f5e6 (patch) | |
tree | 23792455e8ef69f701590eee72030225e242c848 /fs | |
parent | 1a96d6dcbf5a10d299d92558e6817dc8f5c21bb4 (diff) |
ext4 crypto: fix memleak in ext4_readdir()
When ext4_bread() fails, fname_crypto_str remains
allocated after return. Fix that.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
CC: Dmitry Monakhov <dmonakhov@virtuozzo.com>
Signed-off-by: Theodore Ts'o <tytso@google.com>
Change-Id: Id3fc6ad39f771a0dbcab0c46a2df4f29cdb398f0
Git-commit: 7bf19038854f2bda589db4224124dee11968cdf3
Git-repo: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
Signed-off-by: Andrey Markovytch <andreym@codeaurora.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/dir.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index 6d17f31a31d7..33f5e2a50cf8 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c @@ -163,8 +163,11 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx) index, 1); file->f_ra.prev_pos = (loff_t)index << PAGE_CACHE_SHIFT; bh = ext4_bread(NULL, inode, map.m_lblk, 0); - if (IS_ERR(bh)) - return PTR_ERR(bh); + if (IS_ERR(bh)) { + err = PTR_ERR(bh); + bh = NULL; + goto errout; + } } if (!bh) { |