* [PATCH] bad bd_fsfreeze_count in freeze_bdev
@ 2013-09-14 2:36 Chuck Coffing
0 siblings, 0 replies; only message in thread
From: Chuck Coffing @ 2013-09-14 2:36 UTC (permalink / raw)
To: linux-kernel; +Cc: Alexander Viro
Hi,
An error path in freeze_bdev screws up the freeze count.
Consider:
- call freeze_bdev with a bdev that's unmounted (stupidity or a race)
- bd_fsfreeze_count is unconditionally incremented on entry
- can't get the sb; error out
- bd_fsfreeze_count is not decremented (oops!)
- call freeze_bdev again just for obnoxiousness...
- since bd_fsfreeze_count is already nonzero, sb is assumed good and deref'd
(CC me, I'm not subscribed)
diff --git a/fs/block_dev.c b/fs/block_dev.c
index c3549ed..f1c5561 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -253,6 +253,7 @@ struct super_block *freeze_bdev(struct block_device *bdev)
}
deactivate_super(sb);
out:
+ bdev->bd_fsfreeze_count--;
sync_blockdev(bdev);
mutex_unlock(&bdev->bd_fsfreeze_mutex);
return sb; /* thaw_bdev releases s->s_umount */
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-09-14 2:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-14 2:36 [PATCH] bad bd_fsfreeze_count in freeze_bdev Chuck Coffing
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox