This is a note to let you know that I've just added the patch titled

    net: packet: fix information leak to userland

to the 2.6.33-longterm tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/longterm/longterm-queue-2.6.33.git;a=summary

The filename of the patch is:
     net-packet-fix-information-leak-to-userland.patch
and it can be found in the queue-2.6.33 subdirectory.

If you, or anyone else, feels it should not be added to the 2.6.33 longterm 
tree,
please let <[email protected]> know about it.


>From 67286640f638f5ad41a946b9a3dc75327950248f Mon Sep 17 00:00:00 2001
From: Vasiliy Kulikov <[email protected]>
Date: Wed, 10 Nov 2010 12:09:10 -0800
Subject: net: packet: fix information leak to userland

From: Vasiliy Kulikov <[email protected]>

commit 67286640f638f5ad41a946b9a3dc75327950248f upstream.

packet_getname_spkt() doesn't initialize all members of sa_data field of
sockaddr struct if strlen(dev->name) < 13.  This structure is then copied
to userland.  It leads to leaking of contents of kernel stack memory.
We have to fully fill sa_data with strncpy() instead of strlcpy().

The same with packet_getname(): it doesn't initialize sll_pkttype field of
sockaddr_ll.  Set it to zero.

Signed-off-by: Vasiliy Kulikov <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Cc: Moritz Muehlenhoff <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 net/packet/af_packet.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1523,7 +1523,7 @@ static int packet_getname_spkt(struct so
        rcu_read_lock();
        dev = dev_get_by_index_rcu(sock_net(sk), pkt_sk(sk)->ifindex);
        if (dev)
-               strlcpy(uaddr->sa_data, dev->name, 15);
+               strncpy(uaddr->sa_data, dev->name, 14);
        else
                memset(uaddr->sa_data, 0, 14);
        rcu_read_unlock();
@@ -1546,6 +1546,7 @@ static int packet_getname(struct socket
        sll->sll_family = AF_PACKET;
        sll->sll_ifindex = po->ifindex;
        sll->sll_protocol = po->num;
+       sll->sll_pkttype = 0;
        rcu_read_lock();
        dev = dev_get_by_index_rcu(sock_net(sk), po->ifindex);
        if (dev) {


Patches currently in longterm-queue-2.6.33 which might be from 
[email protected] are

/home/gregkh/linux/longterm/longterm-queue-2.6.33/queue-2.6.33/sound-oss-midi_synth-check-get_user-return-value.patch
/home/gregkh/linux/longterm/longterm-queue-2.6.33/queue-2.6.33/net-tipc-fix-information-leak-to-userland.patch
/home/gregkh/linux/longterm/longterm-queue-2.6.33/queue-2.6.33/net-ax25-fix-information-leak-to-userland.patch
/home/gregkh/linux/longterm/longterm-queue-2.6.33/queue-2.6.33/net-packet-fix-information-leak-to-userland.patch

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to