Commit aeaf64c5 authored by Al Viro's avatar Al Viro Committed by Jiri Slaby

__dentry_path() fixes

commit f6500801 upstream.

* we need to save the starting point for restarts
* reject pathologically short buffers outright
Spotted-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
Spotted-by: default avatarOleg Nesterov <oleg@redhat.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 12716b12
......@@ -3122,19 +3122,22 @@ char *simple_dname(struct dentry *dentry, char *buffer, int buflen)
/*
* Write full pathname from the root of the filesystem into the buffer.
*/
static char *__dentry_path(struct dentry *dentry, char *buf, int buflen)
static char *__dentry_path(struct dentry *d, char *buf, int buflen)
{
struct dentry *dentry;
char *end, *retval;
int len, seq = 0;
int error = 0;
if (buflen < 2)
goto Elong;
rcu_read_lock();
restart:
dentry = d;
end = buf + buflen;
len = buflen;
prepend(&end, &len, "\0", 1);
if (buflen < 1)
goto Elong;
/* Get '/' right */
retval = end-1;
*retval = '/';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment