OpenVZ Forum


Home » Mailing lists » Devel » [PATCH net-2.6.26 5/5][NETNS]: Minor information leak via /proc/net/ptype file.
[PATCH net-2.6.26 5/5][NETNS]: Minor information leak via /proc/net/ptype file. [message #28560] Mon, 24 March 2008 10:55 Go to next message
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
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>

---
 net/core/dev.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index f973e38..aebd086 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)
 
 	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
@@ -2639,7 +2639,8 @@ 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 = {
@@ -2647,7 +2648,7 @@ static const struct file_operations ptype_seq_fops = {
 	.open    = ptype_seq_open,
 	.read    = seq_read,
 	.llseek  = seq_lseek,
-	.release = seq_release,
+	.release = seq_release_net,
 };
 
 
-- 
1.5.3.4
Re: [PATCH net-2.6.26 5/5][NETNS]: Minor information leak via /proc/net/ptype file. [message #28592 is a reply to message #28560] Mon, 24 March 2008 21:58 Go to previous message
davem is currently offline  davem
Messages: 463
Registered: February 2006
Senior Member
From: Pavel Emelyanov <xemul@openvz.org>
Date: Mon, 24 Mar 2008 13:55:09 +0300

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

Applied.
Previous Topic: [PATCH net-2.6.26 4/5][NETNS][UDP-Lite]: Register /proc/net/udplite(6) in a namespace.
Next Topic: [PATCH 0/11 net-2.6.26] UDP/ICMP/TCP for a namespace
Goto Forum:
  


Current Time: Sat May 25 01:14:23 GMT 2024

Total time taken to generate the page: 0.01632 seconds