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, 9 Sep 2013 10:30:28 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Al Viro <viro@...IV.linux.org.uk>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Waiman Long <waiman.long@...com>,
	Ingo Molnar <mingo@...nel.org>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	Jeff Layton <jlayton@...hat.com>,
	Miklos Szeredi <mszeredi@...e.cz>,
	Ingo Molnar <mingo@...hat.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	linux-fsdevel <linux-fsdevel@...r.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Andi Kleen <andi@...stfloor.org>,
	"Chandramouleeswaran, Aswin" <aswin@...com>,
	"Norton, Scott J" <scott.norton@...com>
Subject: Re: [PATCH v7 1/4] spinlock: A new lockref structure for lockless
 update of refcount

On Sun, Sep 01, 2013 at 01:13:06AM +0100, Al Viro wrote:

> +static noinline_for_stack
> +char *dentry_name(char *buf, char *end, const struct dentry *d, struct printf_spec spec,
> +		  int depth)
> +{
> +	int i, n = 0;
> +	const char *s;
> +	char *p = buf;
> +	const struct dentry *array[4];
> +	char c;
> +
> +	if (depth < 0) {
> +		depth = 1;
> +		WARN_ON(1);
> +	}
> +	if (depth > 4) {
> +		depth = 4;
> +		WARN_ON(1);
> +	}
> +
> +	rcu_read_lock();
> +	for (i = 0; i < depth; i++) {
> +		struct dentry *p = ACCESS_ONCE(d->d_parent);
> +		array[i] = d;
> +		if (d == p)
> +			break;
> +		d = p;
> +	}
> +	if (!i) {	/* root dentry has a bloody inconvenient name */
> +		i++;
> +		goto do_name;
> +	}
> +	if (i == depth)
> +		goto do_name;
> +	while (i && n != spec.precision) {
> +		if (buf < end)
> +			*buf = '/';
> +		buf++;
> +		n++;
> +do_name:
> +		s = ACCESS_ONCE(array[--i]->d_name.name);
> +		while (n != spec.precision && (c = *s++) != '\0') {
> +			if (buf < end)
> +				*buf = c;
> +			buf++;
> +			n++;
> +		}
> +	}
> +	rcu_read_unlock();

Should one or both of those ACCESS_ONCE()s be an rcu_dereference()?
--
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