lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 7 Sep 2010 16:43:49 -0500
From:	"Arce, Abraham" <x0066660@...com>
To:	Eric Dumazet <eric.dumazet@...il.com>,
	David Miller <davem@...emloft.net>
CC:	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"Shilimkar, Santosh" <santosh.shilimkar@...com>,
	"Ha, Tristram" <Tristram.Ha@...rel.com>
Subject: RE: NULL Pointer Deference: NFS & Telnet

Eric, David,

> From: Eric Dumazet [mailto:eric.dumazet@...il.com]

[..]

> > By increasing the allocation length of our rx skbuff the corruption issue is
> fixed... I have increased it by 2... Were we writing outside our boundaries of
> skb data?
> >
>
> Yes that makes sense, nr_frag is right after the packet (padded to L1
> cache size)
>
> But please do the correct allocation ?
>
> Also, we dont need FCS ?

FCS -> CRC is enable in hardware, under ks8851_net_open()

 TXCR_TXCRC | /* add CRC */

How about the following patch? I am using added helper function:
netdev_alloc_skb_ip_align()

diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c
index b4fb07a..df70a83 100644
--- a/drivers/net/ks8851.c
+++ b/drivers/net/ks8851.c
@@ -503,17 +503,14 @@ static void ks8851_rx_pkts(struct ks8851_net *ks)
                ks8851_wrreg16(ks, KS_RXQCR,
                               ks->rc_rxqcr | RXQCR_SDA | RXQCR_ADRFE);

-               if (rxlen > 0) {
-                       skb = netdev_alloc_skb(ks->netdev, rxlen + 2 + 8);
+               if (rxlen > 4) {
+                       rxlen -= 4;
+                       skb = netdev_alloc_skb_ip_align(ks->netdev, 2 + rxlen);
                        if (!skb) {
                                /* todo - dump frame and move on */
                        }

-                       /* two bytes to ensure ip is aligned, and four bytes
-                        * for the status header and 4 bytes of garbage */
-                       skb_reserve(skb, 2 + 4 + 4);
-
-                       rxpkt = skb_put(skb, rxlen - 4) - 8;
+                       rxpkt = skb_put(skb, rxlen) - 8;

                        /* align the packet length to 4 bytes, and add 4 bytes
                         * as we're getting the rx status header as well */
@@ -526,7 +523,7 @@ static void ks8851_rx_pkts(struct ks8851_net *ks)
                        netif_rx(skb);

                        ks->netdev->stats.rx_packets++;
-                       ks->netdev->stats.rx_bytes += rxlen - 4;
+                       ks->netdev->stats.rx_bytes += rxlen;
                }

                ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr);

Best Regards
Abraham
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ