mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Denys Vlasenko <dvlasenk@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Denys Vlasenko <dvlasenk@redhat.com>, Al Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH] dcache: fix locking bug in __dentry_path()
Date: Fri, 24 Jan 2014 11:21:26 +0100	[thread overview]
Message-ID: <1390558886-4152-1-git-send-email-dvlasenk@redhat.com> (raw)

If given buffer size is zero, we forget to rcu_read_unlock()
on error path.

Cc: linux-kernel@vger.kernel.org
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
---
 fs/dcache.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index cb4a106..24a01fc 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -3127,8 +3127,11 @@ restart:
 	end = buf + buflen;
 	len = buflen;
 	prepend(&end, &len, "\0", 1);
-	if (buflen < 1)
+	if (buflen < 1) {
+		if (!(seq & 1))
+			rcu_read_unlock();
 		goto Elong;
+	}
 	/* Get '/' right */
 	retval = end-1;
 	*retval = '/';
-- 
1.8.1.4


             reply	other threads:[~2014-01-24 10:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-24 10:21 Denys Vlasenko [this message]
2014-01-24 12:24 ` Al Viro
2014-01-24 13:42   ` Denys Vlasenko

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=1390558886-4152-1-git-send-email-dvlasenk@redhat.com \
    --to=dvlasenk@redhat.com \
    --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

all inboxes | Powered by JetHome®