[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A2CEB9E.7080109@gmail.com>
Date: Mon, 08 Jun 2009 12:44:46 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Vegard Nossum <vegard.nossum@...il.com>,
"David S. Miller" <davem@...emloft.net>
CC: John Dykstra <john.dykstra1@...il.com>,
Linux Netdev List <netdev@...r.kernel.org>,
Ingo Molnar <mingo@...e.hu>,
Pekka Enberg <penberg@...helsinki.fi>,
LKML <linux-kernel@...r.kernel.org>,
Jiri Pirko <jpirko@...hat.com>
Subject: [PATCH net-next-2.6] net: loopback device dev->addr_len fix
Vegard Nossum a écrit :
> 2009/6/7 John Dykstra <john.dykstra1@...il.com>:
>> On Sat, 2009-05-30 at 22:23 +0200, Vegard Nossum wrote:
>>> It seems that loopback's hardware address is never initialized by the
>>> kernel. So if userspace attempts to read this address before it has
>>> been set, the kernel will return some uninitialized data (only 6
>>> bytes, though).
>> Thank you for the report, Vegard.
>>
>> I've been unable to reproduce the problem you describe, using
>> 2.6-30-rc8, this test program and a couple of kernel builds for system
>> load:
> [...]
>> ------------------------------------------------------------------
>>
>> Looking at the kernel code, it appears that all bytes of struct
>> net_device, including the L2 address, are initialized to zeros at
>> interface creation time.
>>
>> Can you spot a difference between your test procedures and mine that
>> would enable me to reproduce the problem?
>
> Hi,
>
> I just tried your test program on a linux-next kernel, it works beautifully :-)
>
> (I made one change: The stack grows downwards on x86, so I think you
> should put child_stack + 16386 as the stack to clone()?)
>
> As I wrote in reply to Stephen Hemminger, this problem seems to be
> caused by a particular patch in linux-next:
>
> commit f001fde5eadd915f4858d22ed70d7040f48767cf
> Author: Jiri Pirko <jpirko@...hat.com>
> Date: Tue May 5 02:48:28 2009 +0000
>
> net: introduce a list of device addresses dev_addr_list (v6)
>
I believe following patch should fix this problem.
Thank you
[PATCH net-next-2.6] net: loopback device dev->addr_len fix
commit f001fde5eadd915f4858d22ed70d7040f48767cf
(net: introduce a list of device addresses dev_addr_list (v6))
added one regression Vegard Nossum found in its testings.
loopback device doesnt have a hw address, we should set its
dev->addr_len to 0, not ETH_ALEN.
Reported-by: Vegard Nossum <vegard.nossum@...il.com>
Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
---
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index da472c6..40ded4e 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -166,7 +166,7 @@ static void loopback_setup(struct net_device *dev)
{
dev->mtu = (16 * 1024) + 20 + 20 + 12;
dev->hard_header_len = ETH_HLEN; /* 14 */
- dev->addr_len = ETH_ALEN; /* 6 */
+ dev->addr_len = 0;
dev->tx_queue_len = 0;
dev->type = ARPHRD_LOOPBACK; /* 0x0001*/
dev->flags = IFF_LOOPBACK;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists