[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130904010301.GE13318@ZenIV.linux.org.uk>
Date: Wed, 4 Sep 2013 02:03:02 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Ian Kent <raven@...maw.net>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
rui.xiang@...wei.com, autofs mailing list <autofs@...r.kernel.org>,
Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] autofs4 - fix device ioctl mount lookup
On Wed, Sep 04, 2013 at 08:54:57AM +0800, Ian Kent wrote:
> +static int kern_path_top(const char *pathname,
> + unsigned int flags, struct path *path)
> +{
> + struct dentry *dentry;
> + struct qstr name;
> + const char *tmp;
> + unsigned int len;
> + int err;
> +
> + len = strlen(pathname);
> + if (len <= 1)
> + return -EINVAL;
> +
> + tmp = pathname + len - 1;
> + len = 0;
> + if (*tmp == '/')
> + tmp--;
> + do {
> + if (*tmp == '/')
> + break;
> + len++;
> + } while (--tmp >= pathname);
> + tmp++;
> +
> + err = kern_path(pathname, flags | LOOKUP_PARENT, path);
> + if (err)
> + return err;
> +
> + name.name = tmp;
> + name.len = len;
> + name.hash = full_name_hash(tmp, len);
> +
> + dentry = d_lookup(path->dentry, &name);
> + if (!dentry) {
> + path_put(path);
> + return -ENOENT;
> + }
> + dput(path->dentry);
> + path->dentry = dentry;
> +
> + while (follow_down_one(path))
> + ;
> +
> + return 0;
> +}
Ewwww... NAK in that form. Just what will happen if the last component
given to that sucker will be . or .., for starters? Or a symlink, with
'/' added to it to force following the damn thing?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists