diff mbox series

vfs: potential deadlock in insert_inode_locked()

Message ID 20180803193101.e422aso76vzbo3ko@kili.mountain (mailing list archive)
State New, archived
Headers show
Series vfs: potential deadlock in insert_inode_locked() | expand

Commit Message

Dan Carpenter Aug. 3, 2018, 7:31 p.m. UTC
We added a new error path to insert_inode_locked() but we need to drop
the inode_hash_lock spin_lock before we return.

Fixes: 397127e49ff5 ("new primitive: discard_new_inode()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Al Viro Aug. 3, 2018, 8:05 p.m. UTC | #1
On Fri, Aug 03, 2018 at 10:31:01PM +0300, Dan Carpenter wrote:
> We added a new error path to insert_inode_locked() but we need to drop
> the inode_hash_lock spin_lock before we return.

Folded, with credits.
diff mbox series

Patch

diff --git a/fs/inode.c b/fs/inode.c
index 593d0cfce27c..ed7c18495cd9 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1462,6 +1462,7 @@  int insert_inode_locked(struct inode *inode)
 		}
 		if (unlikely(old->i_state & I_CREATING)) {
 			spin_unlock(&old->i_lock);
+			spin_unlock(&inode_hash_lock);
 			return -EBUSY;
 		}
 		__iget(old);