lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 29 Nov 2010 00:54:57 +0300
From:	Cyrill Gorcunov <gorcunov@...il.com>
To:	Vegard Nossum <vegard.nossum@...il.com>
Cc:	Al Viro <viro@...iv.linux.org.uk>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: proc: proc_self_follow_link() weirdness

On Sun, Nov 28, 2010 at 09:09:03PM +0100, Vegard Nossum wrote:
> Hi,
> 
> I came across this code in fs/proc/base.c:
> 
> static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd)
> {
>         struct pid_namespace *ns = dentry->d_sb->s_fs_info;
>         pid_t tgid = task_tgid_nr_ns(current, ns);
>         char *name = ERR_PTR(-ENOENT);
>         if (tgid) {
>                 name = __getname();
>                 if (!name)
>                         name = ERR_PTR(-ENOMEM);
>                 else
>                         sprintf(name, "%d", tgid);
>         }
>         nd_set_link(nd, name);
>         return NULL;
> }
> 
> This looks a bit weird to me; it seems that nd_set_link() will get
> called with name = ERR_PTR(-ENOMEM) if __getname() fails. Is this the
> intended behaviour? Shouldn't it return this ERR_PTR() instead?
> 
> 
> Vegard

nd_get_link callers do check for IS_ERR (directly or indirectly),
but to return 'name' here would be more appropriate I guess. Al?

  Cyrill
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ