From: Eric Dumazet <eric.dumazet@gmail.com>
To: "Arce, Abraham" <x0066660@ti.com>
Cc: David Miller <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
"tony@atomide.com" <tony@atomide.com>,
"Shilimkar, Santosh" <santosh.shilimkar@ti.com>,
"Ha, Tristram" <Tristram.Ha@micrel.com>
Subject: RE: NULL Pointer Deference: NFS & Telnet
Date: Wed, 26 May 2010 22:48:53 +0200 [thread overview]
Message-ID: <1274906933.2542.17.camel@edumazet-laptop> (raw)
In-Reply-To: <27F9C60D11D683428E133F85D2BB4A53043E3EE6A3@dlee03.ent.ti.com>
Le mercredi 26 mai 2010 à 15:19 -0500, Arce, Abraham a écrit :
> 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?
>
> Please let me know about this approach...
>
> diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c
> index b4fb07a..6da81e1 100644
> --- a/drivers/net/ks8851.c
> +++ b/drivers/net/ks8851.c
> @@ -504,7 +504,7 @@ static void ks8851_rx_pkts(struct ks8851_net *ks)
> ks->rc_rxqcr | RXQCR_SDA | RXQCR_ADRFE);
>
> if (rxlen > 0) {
> - skb = netdev_alloc_skb(ks->netdev, rxlen + 2 + 8);
> + skb = netdev_alloc_skb(ks->netdev, rxlen + 4 + 8);
> if (!skb) {
>
> Best Regards
> Abraham
>
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 ?
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c
index b4fb07a..05bd312 100644
--- a/drivers/net/ks8851.c
+++ b/drivers/net/ks8851.c
@@ -503,8 +503,9 @@ 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(ks->netdev, 2 + 8 + ALIGN(rxlen, 4));
if (!skb) {
/* todo - dump frame and move on */
}
@@ -513,7 +514,7 @@ static void ks8851_rx_pkts(struct ks8851_net *ks)
* 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 +527,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);
next prev parent reply other threads:[~2010-05-26 20:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-25 2:19 NULL Pointer Deference: NFS & Telnet Arce, Abraham
[not found] ` <27F9C60D11D683428E133F85D2BB4A53043E33A997-lTKHBJngVwKIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2010-05-26 1:48 ` Arce, Abraham
[not found] ` <27F9C60D11D683428E133F85D2BB4A53043E3EDFE6-lTKHBJngVwKIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2010-05-26 1:52 ` David Miller
[not found] ` <20100525.185236.193707791.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2010-05-26 2:02 ` Arce, Abraham
[not found] ` <27F9C60D11D683428E133F85D2BB4A53043E3EDFF1-lTKHBJngVwKIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2010-05-26 5:29 ` Eric Dumazet
2010-05-26 20:19 ` Arce, Abraham
2010-05-26 20:48 ` Eric Dumazet [this message]
2010-06-04 23:15 ` David Miller
2010-09-07 21:43 ` Arce, Abraham
2010-09-08 16:15 ` Eric Dumazet
2010-09-08 23:27 ` Arce, Abraham
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1274906933.2542.17.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=Tristram.Ha@micrel.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=santosh.shilimkar@ti.com \
--cc=tony@atomide.com \
--cc=x0066660@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox