mirror of
https://gitee.com/bianbu-linux/linux-6.6-fh
synced 2025-04-25 06:58:35 -04:00
gfs2: Refcounting fix in gfs2_thaw_super
[ Upstream commit 4e58543e7da4859c4ba61d15493e3522b6ad71fd ] It turns out that the .freeze_super and .thaw_super operations require the filesystem to manage the superblock refcount itself. We are using the freeze_super() and thaw_super() helpers to mostly take care of that for us, but this means that the superblock may no longer be around by when thaw_super() returns, and gfs2_thaw_super() will then access freed memory. Take an extra superblock reference in gfs2_thaw_super() to fix that. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
3cde81f8ad
commit
73567149be
1 changed files with 2 additions and 0 deletions
|
@ -819,6 +819,7 @@ static int gfs2_thaw_super(struct super_block *sb, enum freeze_holder who)
|
||||||
if (!test_bit(SDF_FREEZE_INITIATOR, &sdp->sd_flags))
|
if (!test_bit(SDF_FREEZE_INITIATOR, &sdp->sd_flags))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
atomic_inc(&sb->s_active);
|
||||||
gfs2_freeze_unlock(&sdp->sd_freeze_gh);
|
gfs2_freeze_unlock(&sdp->sd_freeze_gh);
|
||||||
|
|
||||||
error = gfs2_do_thaw(sdp);
|
error = gfs2_do_thaw(sdp);
|
||||||
|
@ -829,6 +830,7 @@ static int gfs2_thaw_super(struct super_block *sb, enum freeze_holder who)
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&sdp->sd_freeze_mutex);
|
mutex_unlock(&sdp->sd_freeze_mutex);
|
||||||
|
deactivate_super(sb);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue