Files
linux/fs
Alexey Dobriyan 6ccab11c56 proc: fix lookup in /proc/net subdirectories after setns(2)
[ Upstream commit c6c75deda8 ]

Commit 1fde6f21d9 ("proc: fix /proc/net/* after setns(2)") only forced
revalidation of regular files under /proc/net/

However, /proc/net/ is unusual in the sense of /proc/net/foo handlers
take netns pointer from parent directory which is old netns.

Steps to reproduce:

	(void)open("/proc/net/sctp/snmp", O_RDONLY);
	unshare(CLONE_NEWNET);

	int fd = open("/proc/net/sctp/snmp", O_RDONLY);
	read(fd, &c, 1);

Read will read wrong data from original netns.

Patch forces lookup on every directory under /proc/net .

Link: https://lkml.kernel.org/r/20201205160916.GA109739@localhost.localdomain
Fixes: 1da4d377f9 ("proc: revalidate misc dentries")
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Reported-by: "Rantala, Tommi T. (Nokia - FI/Espoo)" <tommi.t.rantala@nokia.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-01-12 20:10:17 +01:00
..
2020-11-05 11:08:53 +01:00
2019-08-06 19:06:51 +02:00
2020-10-30 10:38:28 +01:00
2018-08-17 16:20:28 -07:00
2020-12-30 11:26:13 +01:00
2020-11-18 19:18:49 +01:00
2018-05-22 14:27:52 -04:00
2020-11-05 11:08:50 +01:00
2020-06-22 09:05:01 +02:00
2018-07-03 16:44:45 -04:00
2018-06-05 19:23:26 +02:00
2020-03-05 16:42:12 +01:00
2020-03-25 08:06:14 +01:00
2018-06-11 08:22:34 -07:00