aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Tkhai <ktkhai@virtuozzo.com>2016-02-16 00:20:19 -0500
committerMister Oyster <oysterized@gmail.com>2017-05-29 03:52:06 +0200
commitdfd30ee2416625496339f1a59e1d708a3fa95ea7 (patch)
treea46cb295d1cb933c48b5cf32263ae509bf547ecd
parent1487abde26ae07c507d95f4a59021b2f647e64f1 (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: Ie137cb7be090c52c65c65872035b537ece8c2f17
-rw-r--r--fs/ext4/dir.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index c3230fbdd..e52b121c9 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -167,8 +167,11 @@ static int ext4_readdir2(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) {