Commit 4e79ee42 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] set_anon_super locking fix

Take the idr's lock while removing an element on the error path.  Spotted by
Nathan Lynch <nathanl@austin.ibm.com>.
parent 8eeff89b
...@@ -562,7 +562,9 @@ int set_anon_super(struct super_block *s, void *data) ...@@ -562,7 +562,9 @@ int set_anon_super(struct super_block *s, void *data)
spin_unlock(&unnamed_dev_lock); spin_unlock(&unnamed_dev_lock);
if ((dev & MAX_ID_MASK) == (1 << MINORBITS)) { if ((dev & MAX_ID_MASK) == (1 << MINORBITS)) {
spin_lock(&unnamed_dev_lock);
idr_remove(&unnamed_dev_idr, dev); idr_remove(&unnamed_dev_idr, dev);
spin_unlock(&unnamed_dev_lock);
return -EMFILE; return -EMFILE;
} }
s->s_dev = MKDEV(0, dev & MINORMASK); s->s_dev = MKDEV(0, dev & MINORMASK);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment