Re: [PATCH 2.6.14-rc2] aoe [1/2]: explicitly set minimum packet length to ETH_ZLEN

Ed L Cashin
2005-09-26T22:31:47Z

Valdis.Kletnieks@vt.edu writes:

...
> I haven't chased through the code in detail - will this change ensure that
> all ETH_ZLEN bytes are initialized? We had a bunch of drivers a few years
> ago that set the length to the legal min, but then only copied some smaller
> number of bytes in, resulting in leakage of kernel memory contents....

No, it looks like alloc_skb just kmallocs the data, so I'd need to
follow up with something like this:

diff -rN -u old-aoe-2.6-stand/linux/drivers/block/aoe/aoecmd.c new-aoe-2.6-stand/linux/drivers/block/aoe/aoecmd.c
--- old-aoe-2.6-stand/linux/drivers/block/aoe/aoecmd.c 2005-09-26 18:25:19.000000000 -0400
+++ new-aoe-2.6-stand/linux/drivers/block/aoe/aoecmd.c 2005-09-26 17:08:21.000000000 -0400
@@ -26,6 +26,7 @@

skb = alloc_skb(len, GFP_ATOMIC);
if (skb) {
+ memset(skb->head, 0, skb->end - skb->head);
skb->nh.raw = skb->mac.raw = skb->data;
skb->dev = if_dev;
skb->protocol = __constant_htons(ETH_P_AOE);

--
Ed L Cashin <ecashin@coraid.com>