[CHECKER] A potential memory leak in fs/jbd/commit.c (2.4.19)

From: Junfeng Yang
Date: Tue Apr 27 2004 - 01:46:27 EST



Below is a potential leak in file fs/jbd/commit.c
------------------------------------------------------------------------------
[BUG] jb->b_commited_data && jh->b_frozen_data may be leaked when journal
is aborted. journal will be set to abort when we can't locate the next
log block or we can't get a new descriptor. if current journal head jh
happens to have b_commited_data or b_frozen_data associated with it,
they'll be leaked.

void journal_commit_transaction(journal_t *journal)
{

....

while (commit_transaction->t_buffers) {

/* Find the next buffer to be journaled... */

jh = commit_transaction->t_buffers;

/* If we're in abort mode, we just un-journal the buffer and
release it for background writing. */

if (is_journal_aborted(journal)) {
JBUFFER_TRACE(jh, "journal is aborting: refile");
ERROR--> journal_refile_buffer(jh);
/* If that was the last one, we need to clean up
* any descriptor buffers which may have been
* already allocated, even if we are now
* aborting. */
if (!commit_transaction->t_buffers)
goto start_journal_io;
continue;
}

....
/* Where is the buffer to be written? */

err = journal_next_log_block(journal, &blocknr);
/* If the block mapping failed, just abandon the buffer
and repeat this loop: we'll fall into the
refile-on-abort condition above. */
if (err) {
ABORT--> __journal_abort_hard(journal);
continue;
}
...
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/