aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-03-24 17:57:45 -0400
committerDavid S. Miller <davem@davemloft.net>2008-03-24 17:57:45 -0400
commit2feb27dbe00cbb4f7d31f90acf6bd0d751dd0a50 (patch)
tree0d0a38668b02e18d487d15eba730721e21bba353 /net/core
parent84c375af0ff61e0bd15fac0aed0438640494483e (diff)
[NETNS]: Minor information leak via /proc/net/ptype file.
This file displays the registered packet types, but some of them (packet sockets creates such) can be bound to a net device and showing them in a wrong namespace is not correct. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index f973e38b81af..aebd08606040 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2615,7 +2615,7 @@ static int ptype_seq_show(struct seq_file *seq, void *v)
2615 2615
2616 if (v == SEQ_START_TOKEN) 2616 if (v == SEQ_START_TOKEN)
2617 seq_puts(seq, "Type Device Function\n"); 2617 seq_puts(seq, "Type Device Function\n");
2618 else { 2618 else if (pt->dev == NULL || pt->dev->nd_net == seq_file_net(seq)) {
2619 if (pt->type == htons(ETH_P_ALL)) 2619 if (pt->type == htons(ETH_P_ALL))
2620 seq_puts(seq, "ALL "); 2620 seq_puts(seq, "ALL ");
2621 else 2621 else
@@ -2639,7 +2639,8 @@ static const struct seq_operations ptype_seq_ops = {
2639 2639
2640static int ptype_seq_open(struct inode *inode, struct file *file) 2640static int ptype_seq_open(struct inode *inode, struct file *file)
2641{ 2641{
2642 return seq_open(file, &ptype_seq_ops); 2642 return seq_open_net(inode, file, &ptype_seq_ops,
2643 sizeof(struct seq_net_private));
2643} 2644}
2644 2645
2645static const struct file_operations ptype_seq_fops = { 2646static const struct file_operations ptype_seq_fops = {
@@ -2647,7 +2648,7 @@ static const struct file_operations ptype_seq_fops = {
2647 .open = ptype_seq_open, 2648 .open = ptype_seq_open,
2648 .read = seq_read, 2649 .read = seq_read,
2649 .llseek = seq_lseek, 2650 .llseek = seq_lseek,
2650 .release = seq_release, 2651 .release = seq_release_net,
2651}; 2652};
2652 2653
2653 2654