[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1430899514-19128-2-git-send-email-lczerner@redhat.com>
Date: Wed, 6 May 2015 10:05:14 +0200
From: Lukas Czerner <lczerner@...hat.com>
To: tytso@....edu
Cc: linux-ext4@...r.kernel.org, Lukas Czerner <lczerner@...hat.com>
Subject: [PATCH 2/2] jbd2: Fix memory leak in jbd2_journal_stop()
Currently in the case that we've got to the jbd2_journal_stop() with
already sopped handle we might leak the memory previously allocated
for the reserved handle because we only free the handle structure
leaving handle->h_rsv_handle intact.
Fix it by freeing the handle->h_rsv_handle structure in case we're
dealing with already stopped handle in jbd2_journal_stop().
Signed-off-by: Lukas Czerner <lczerner@...hat.com>
---
fs/jbd2/transaction.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 34bd0c5..807c378 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -1535,8 +1535,11 @@ int jbd2_journal_stop(handle_t *handle)
jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1,
handle->h_ref);
return err;
- } else
+ } else {
+ if (handle->h_rsv_handle)
+ jbd2_free_handle(handle->h_rsv_handle);
goto free_and_exit;
+ }
}
journal = transaction->t_journal;
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists