All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: Fix memleak in ext4_readdir()
@ 2016-01-19 14:42 Kirill Tkhai
  2016-02-16  5:25 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Kirill Tkhai @ 2016-01-19 14:42 UTC (permalink / raw)
  To: linux-ext4; +Cc: dmonakhov, tytso

When ext4_bread() fails, fname_crypto_str remains
allocated after return. Fix that.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
CC: Theodore Ts'o <tytso@mit.edu>
CC: Dmitry Monakhov <dmonakhov@virtuozzo.com>
---
 fs/ext4/dir.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index 1d1bca7..def3215 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -157,8 +157,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) {


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: Fix memleak in ext4_readdir()
  2016-01-19 14:42 [PATCH] ext4: Fix memleak in ext4_readdir() Kirill Tkhai
@ 2016-02-16  5:25 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2016-02-16  5:25 UTC (permalink / raw)
  To: Kirill Tkhai; +Cc: linux-ext4, dmonakhov

On Tue, Jan 19, 2016 at 05:42:08PM +0300, Kirill Tkhai wrote:
> When ext4_bread() fails, fname_crypto_str remains
> allocated after return. Fix that.
> 
> Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
> CC: Theodore Ts'o <tytso@mit.edu>
> CC: Dmitry Monakhov <dmonakhov@virtuozzo.com>

Applied, thanks.

					- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-16  5:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-19 14:42 [PATCH] ext4: Fix memleak in ext4_readdir() Kirill Tkhai
2016-02-16  5:25 ` Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.