Signed-off-by: Andrew Morton --- fs/jbd2/journal.c | 2 +- include/linux/jbd2.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff -puN fs/jbd2/journal.c~ext4-jbd-stats-through-procfs_fix fs/jbd2/journal.c --- a/fs/jbd2/journal.c~ext4-jbd-stats-through-procfs_fix +++ a/fs/jbd2/journal.c @@ -751,7 +751,7 @@ static int jbd2_seq_history_open(struct return -EIO; size = sizeof(struct transaction_stats_s) * journal->j_history_max; s->stats = kmalloc(size, GFP_KERNEL); - if (s == NULL) { + if (s->stats == NULL) { kfree(s); return -EIO; } diff -puN include/linux/jbd2.h~ext4-jbd-stats-through-procfs_fix include/linux/jbd2.h --- a/include/linux/jbd2.h~ext4-jbd-stats-through-procfs_fix +++ a/include/linux/jbd2.h @@ -927,6 +927,9 @@ struct journal_s struct transaction_stats_s *j_history; int j_history_max; int j_history_cur; + /* + * Protect the transactions statistics history + */ spinlock_t j_history_lock; struct proc_dir_entry *j_proc_entry; struct transaction_stats_s j_stats; _