From: Chuck Coffing <clc@alum.mit.edu>
To: linux-kernel@vger.kernel.org
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH] bad bd_fsfreeze_count in freeze_bdev
Date: Fri, 13 Sep 2013 20:36:55 -0600 [thread overview]
Message-ID: <20130914023655.GA3212@server.mountain-tech.net> (raw)
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 */
reply other threads:[~2013-09-14 2:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130914023655.GA3212@server.mountain-tech.net \
--to=clc@alum.mit.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox