From: Denys Vlasenko <dvlasenk@redhat.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dcache: fix locking bug in __dentry_path()
Date: Fri, 24 Jan 2014 14:42:53 +0100 [thread overview]
Message-ID: <52E26DDD.90702@redhat.com> (raw)
In-Reply-To: <20140124122409.GT10323@ZenIV.linux.org.uk>
On 01/24/2014 01:24 PM, Al Viro wrote:
> On Fri, Jan 24, 2014 at 11:21:26AM +0100, Denys Vlasenko wrote:
>> If given buffer size is zero, we forget to rcu_read_unlock()
>> on error path.
>
> Er... Where could we ever get called with size zero? IOW, the
> real question is whether that check makes any sense. If nothing
> else, a much more obvious fix (again, assuming there is a call
> chain that could have triggered that in the first place), would
> be to take that
> if (buflen < 1)
> goto Elong;
> on the very top of __dentry_path(). Note that buflen never
> change, so this check could bloody well be handled once - and
> earlier.
Yes. In fact the check is buggier than I thought:
prepend(&end, &len, "\0", 1);
if (buflen < 1)
goto Elong;
/* Get '/' right */
retval = end-1;
*retval = '/'; <=== !!!
It should be "buflen < 2". With buflen == 1, we touch buffer[-1].
> But again, the callers shouldn't be calling it that
> way...
I'll add a check in d_path() and post another patch.
I assume the assertion should be 'size >= 2', since
path "" should never be produced anyway, the shortest path
is "/"?
--
vda
prev parent reply other threads:[~2014-01-24 13:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-24 10:21 [PATCH] dcache: fix locking bug in __dentry_path() Denys Vlasenko
2014-01-24 12:24 ` Al Viro
2014-01-24 13:42 ` Denys Vlasenko [this message]
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=52E26DDD.90702@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 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.