From: Al Viro <viro@ZenIV.linux.org.uk>
To: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>,
Oleg Nesterov <oleg@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dcache: error out on failures to store terminating NUL
Date: Fri, 24 Jan 2014 12:28:37 +0000 [thread overview]
Message-ID: <20140124122837.GU10323@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1390565866-30868-1-git-send-email-dvlasenk@redhat.com>
On Fri, Jan 24, 2014 at 01:17:46PM +0100, Denys Vlasenko wrote:
> A number of routines wasn't checking that the initial call
> to prepend "\0" to result buffer doesn't fail.
>
> Coredump code was seeing d_path() with zero-sized buffer
> to erroneously return bogus data (non-error pointer
> pointing before buffer start).
>
> Users report that this change fixes it.
NAK. Again, this is not dealing with overflows - it's basic sanity
check on arguments. Choose which level should that be done at and
just do it there. As in "if (!buflen) return -ENAMETOOLONG;".
> char *cwd = page + PATH_MAX;
> int buflen = PATH_MAX;
>
> - prepend(&cwd, &buflen, "\0", 1);
> - error = prepend_path(&pwd, &root, &cwd, &buflen);
> + error = prepend(&cwd, &buflen, "\0", 1);
> + if (!error)
> + error = prepend_path(&pwd, &root, &cwd, &buflen);
Ah, yes - the dreadful case of zero PATH_MAX...
prev parent reply other threads:[~2014-01-24 12:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-24 12:17 [PATCH] dcache: error out on failures to store terminating NUL Denys Vlasenko
2014-01-24 12:28 ` Al Viro [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=20140124122837.GU10323@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=dvlasenk@redhat.com \
--cc=jan.kratochvil@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
/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.