* [PATCH] fs:super:get_anon_bdev: fix race condition could cause dev exceed its upper limitation
@ 2015-06-23 10:54 Wang YanQing
0 siblings, 0 replies; only message in thread
From: Wang YanQing @ 2015-06-23 10:54 UTC (permalink / raw)
To: viro; +Cc: linux-fsdevel, linux-kernel
Execution of get_anon_bdev concurrently and preemptive kernel all
could bring race condition, it isn't enough to check dev against
its upper limitation with equality operator only.
This patch fix it.
Signed-off-by: Wang YanQing <udknight@gmail.com>
---
fs/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/super.c b/fs/super.c
index 928c20f..b613723 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -842,7 +842,7 @@ int get_anon_bdev(dev_t *p)
else if (error)
return -EAGAIN;
- if (dev == (1 << MINORBITS)) {
+ if (dev >= (1 << MINORBITS)) {
spin_lock(&unnamed_dev_lock);
ida_remove(&unnamed_dev_ida, dev);
if (unnamed_dev_start > dev)
--
1.8.5.6.2.g3d8a54e.dirty
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-06-23 11:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-23 10:54 [PATCH] fs:super:get_anon_bdev: fix race condition could cause dev exceed its upper limitation Wang YanQing
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®