linux-stable/fs/jbd2
Jiufei Xue 660e9269d8 jbd2: check superblock mapped prior to committing
commit 742b06b562 upstream.

We hit a BUG at fs/buffer.c:3057 if we detached the nbd device
before unmounting ext4 filesystem.

The typical chain of events leading to the BUG:
jbd2_write_superblock
  submit_bh
    submit_bh_wbc
      BUG_ON(!buffer_mapped(bh));

The block device is removed and all the pages are invalidated. JBD2
was trying to write journal superblock to the block device which is
no longer present.

Fix this by checking the journal superblock's buffer head prior to
submitting.

Reported-by: Eric Ren <renzhen@linux.alibaba.com>
Signed-off-by: Jiufei Xue <jiufei.xue@linux.alibaba.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21 18:50:18 +02:00
..
checkpoint.c jbd2: fix use after free in jbd2_log_do_checkpoint() 2018-11-13 11:15:05 -08:00
commit.c jbd2: fix invalid descriptor block checksum 2019-04-05 22:31:28 +02:00
journal.c jbd2: check superblock mapped prior to committing 2019-05-21 18:50:18 +02:00
Kconfig jbd2: remove debug dependency on debug_fs and update Kconfig help text 2013-06-12 23:07:51 -04:00
Makefile
recovery.c fs: have ll_rw_block users pass in op and flags separately 2016-06-07 13:41:38 -06:00
revoke.c jbd2: don't leak memory if setting up journal fails 2017-03-15 15:08:48 -04:00
transaction.c jbd2: fix compile warning when using JBUFFER_TRACE 2019-03-23 14:35:26 +01:00