Skip to content

Commit

Permalink
[NETNS]: Minor information leak via /proc/net/ptype file.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Mar 24, 2008
1 parent 84c375a commit 2feb27d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2615,7 +2615,7 @@ static int ptype_seq_show(struct seq_file *seq, void *v)

if (v == SEQ_START_TOKEN)
seq_puts(seq, "Type Device Function\n");
else {
else if (pt->dev == NULL || pt->dev->nd_net == seq_file_net(seq)) {
if (pt->type == htons(ETH_P_ALL))
seq_puts(seq, "ALL ");
else
Expand All @@ -2639,15 +2639,16 @@ static const struct seq_operations ptype_seq_ops = {

static int ptype_seq_open(struct inode *inode, struct file *file)
{
return seq_open(file, &ptype_seq_ops);
return seq_open_net(inode, file, &ptype_seq_ops,
sizeof(struct seq_net_private));
}

static const struct file_operations ptype_seq_fops = {
.owner = THIS_MODULE,
.open = ptype_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
.release = seq_release_net,
};


Expand Down

0 comments on commit 2feb27d

Please sign in to comment.