[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20130914023655.GA3212@server.mountain-tech.net>
Date: Fri, 13 Sep 2013 20:36:55 -0600
From: Chuck Coffing <clc@...m.mit.edu>
To: linux-kernel@...r.kernel.org
Cc: Alexander Viro <viro@...iv.linux.org.uk>
Subject: [PATCH] bad bd_fsfreeze_count in freeze_bdev
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 */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists