2023-06-21 14:51:19

by Jan Kara

[permalink] [raw]
Subject: [PATCH 2/2] xfs: Fix crash in ext4_bdev_mark_dead()

xfs_bdev_mark_dead() passes bdev->bd_holder to ext4_force_shutdown()
instead of bdev->bd_super leading to crashes. Fix it.

Fixes: 8067ca1dcdfc ("xfs: wire up the ->mark_dead holder operation for log and RT devices")
Signed-off-by: Jan Kara <[email protected]>
---
fs/xfs/xfs_super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index d910b141d52e..3ab188a6fba1 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -381,7 +381,7 @@ static void
xfs_bdev_mark_dead(
struct block_device *bdev)
{
- xfs_force_shutdown(bdev->bd_holder, SHUTDOWN_DEVICE_REMOVED);
+ xfs_force_shutdown(XFS_M(bdev->bd_super), SHUTDOWN_DEVICE_REMOVED);
}

static const struct blk_holder_ops xfs_holder_ops = {
--
2.35.3



2023-06-21 15:24:41

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 2/2] xfs: Fix crash in ext4_bdev_mark_dead()

On Wed, Jun 21, 2023 at 04:47:43PM +0200, Jan Kara wrote:
> xfs_bdev_mark_dead() passes bdev->bd_holder to ext4_force_shutdown()
> instead of bdev->bd_super leading to crashes. Fix it.

xfs_bdev_mark_dead is only called for the log and RT devices, for which
the mp is passed as holder to blkdev_get_by_path. bd_super won't be
set for those devices, so this patch will introduce a crash and not fix
one.