diff --git a/fs/ext4/super.c b/fs/ext4/super.c index cc065ae90d4f..83ba37be4702 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4754,6 +4754,14 @@ static int ext4_commit_super(struct super_block *sb, int sync) if (!sbh || block_device_ejected(sb)) return error; + + /* + * The superblock bh should be mapped, but it might not be if the + * device was hot-removed. Not much we can do but fail the I/O. + */ + if (!buffer_mapped(sbh)) + return error; + /* * If the file system is mounted read-only, don't update the * superblock write time. This avoids updating the superblock