[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1289524019.5167.66.camel@dan>
Date: Thu, 11 Nov 2010 20:06:59 -0500
From: Dan Rosenberg <drosenberg@...curity.com>
To: "David S. Miller" <davem@...emloft.net>,
Oliver Hartkopp <socketcan@...tkopp.net>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
Urs Thuermann <urs.thuermann@...kswagen.de>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Patrick McHardy <kaber@...sh.net>,
James Morris <jmorris@...ei.org>,
Remi Denis-Courmont <remi.denis-courmont@...ia.com>,
"Pekka Savola (ipv6)" <pekkas@...core.fi>,
Sridhar Samudrala <sri@...ibm.com>,
Vlad Yasevich <vladislav.yasevich@...com>,
Tejun Heo <tj@...nel.org>,
Eric Dumazet <eric.dumazet@...il.com>,
Li Zefan <lizf@...fujitsu.com>, Joe Perches <joe@...ches.com>,
Stephen Hemminger <shemminger@...tta.com>,
Jamal Hadi Salim <hadi@...atatu.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Alexey Dobriyan <adobriyan@...il.com>,
Jiri Pirko <jpirko@...hat.com>,
Johannes Berg <johannes.berg@...el.com>,
Daniel Lezcano <daniel.lezcano@...e.fr>,
Pavel Emelyanov <xemul@...nvz.org>,
socketcan-core@...ts.berlios.de, netdev@...r.kernel.org,
linux-sctp@...r.kernel.org
Subject: [PATCH 2/10] Fix leaking of kernel heap addresses in net/
diff --git a/net/can/bcm.c b/net/can/bcm.c
index 08ffe9e..5960ad7 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -165,9 +165,16 @@ static int bcm_proc_show(struct seq_file *m, void *v)
struct bcm_sock *bo = bcm_sk(sk);
struct bcm_op *op;
- seq_printf(m, ">>> socket %p", sk->sk_socket);
- seq_printf(m, " / sk %p", sk);
- seq_printf(m, " / bo %p", bo);
+ /* Only expose kernel addresses to privileged readers */
+ if (capable(CAP_NET_ADMIN))
+ seq_printf(m, ">>> socket %p", sk->sk_socket);
+ seq_printf(m, " / sk %p", sk);
+ seq_printf(m, " / bo %p", bo);
+ else
+ seq_printf(m, ">>> socket %lu", sock_i_ino(sk));
+ seq_printf(m, " / sk %d", 0);
+ seq_printf(m, " / bo %d", 0);
+
seq_printf(m, " / dropped %lu", bo->dropped_usr_msgs);
seq_printf(m, " / bound %s", bcm_proc_getifname(ifname, bo->ifindex));
seq_printf(m, " <<<\n");
@@ -1520,8 +1527,8 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len,
bo->bound = 1;
if (proc_dir) {
- /* unique socket address as filename */
- sprintf(bo->procname, "%p", sock);
+ /* unique socket inode as filename */
+ sprintf(bo->procname, "%lx", sock_i_ino(sk));
bo->bcm_proc_read = proc_create_data(bo->procname, 0644,
proc_dir,
&bcm_proc_fops, sk);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists