Ritesh Harjani cc16eecae6 jbd2: fix use-after-free of transaction_t race
jbd2_journal_wait_updates() is called with j_state_lock held. But if
there is a commit in progress, then this transaction might get committed
and freed via jbd2_journal_commit_transaction() ->
jbd2_journal_free_transaction(), when we release j_state_lock.
So check for journal->j_running_transaction everytime we release and
acquire j_state_lock to avoid use-after-free issue.

Link: https://lore.kernel.org/r/948c2fed518ae739db6a8f7f83f1d58b504f87d0.1644497105.git.ritesh.list@gmail.com
Fixes: 4f98186848707f53 ("jbd2: refactor wait logic for transaction updates into a common function")
Cc: stable@kernel.org
Reported-and-tested-by: syzbot+afa2ca5171d93e44b348@syzkaller.appspotmail.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2022-02-25 21:28:10 -05:00
..
2022-01-30 22:13:37 +09:00
2022-01-22 08:33:37 +02:00
2021-08-19 09:02:55 +09:00
2022-02-15 09:14:05 -08:00
2021-11-09 10:02:51 -08:00
2021-10-25 19:11:50 -07:00
2022-01-12 11:11:34 -08:00
2021-12-03 18:44:06 +01:00
2022-02-11 11:36:32 -08:00
2021-11-03 09:23:25 -07:00
2022-02-04 00:12:22 -06:00
2022-02-02 10:14:31 -08:00
2022-02-09 09:56:57 -08:00
2022-01-22 08:33:38 +02:00
2022-02-01 11:23:02 -08:00
2022-01-10 11:48:37 -08:00
2022-01-16 10:15:32 +02:00
2021-08-19 09:02:55 +09:00
2022-02-05 09:21:55 -08:00
2021-12-17 16:56:35 +09:00
2022-01-22 08:33:34 +02:00
2021-11-17 09:26:09 +01:00
2022-01-12 13:45:12 -08:00
2022-01-22 08:33:35 +02:00
2022-01-21 16:07:21 +02:00
2022-02-04 00:12:22 -06:00
2022-01-22 08:33:38 +02:00
\n
2022-01-28 17:51:31 +02:00
2022-01-22 08:33:36 +02:00
2021-08-10 17:57:22 +02:00