All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] vfs: potential deadlock in insert_inode_locked()
Date: Fri, 3 Aug 2018 22:31:01 +0300	[thread overview]
Message-ID: <20180803193101.e422aso76vzbo3ko@kili.mountain> (raw)

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>

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);

WARNING: multiple messages have this Message-ID
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] vfs: potential deadlock in insert_inode_locked()
Date: Fri, 03 Aug 2018 19:31:01 +0000	[thread overview]
Message-ID: <20180803193101.e422aso76vzbo3ko@kili.mountain> (raw)

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>

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);

             reply	other threads:[~2018-08-03 21:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-03 19:31 Dan Carpenter [this message]
2018-08-03 19:31 ` Dan Carpenter
2018-08-03 20:05 ` Al Viro
2018-08-03 20:05   ` Al Viro

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=20180803193101.e422aso76vzbo3ko@kili.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --subject='Re: [PATCH] vfs: potential deadlock in insert_inode_locked()' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.