/[linux-patches]/genpatches-2.6/tags/2.6.21-2/2405_sis900-rx-crash.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.21-2/2405_sis900-rx-crash.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 962 - (show annotations) (download)
Fri May 18 22:56:34 2007 UTC (11 years, 3 months ago) by dsd
File size: 2468 byte(s)
2.6.21-2 release
1 From: Neil Horman <nhorman@tuxdriver.com>
2 Date: Thu, 26 Apr 2007 17:47:36 +0000 (-0400)
3 Subject: sis900: Allocate rx replacement buffer before rx operation
4 X-Git-Tag: v2.6.22-rc1~1113^2
5 X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=dc5a144991ba803bc8afded105c9db1dea0e57ab
6
7 sis900: Allocate rx replacement buffer before rx operation
8
9 Just found a hole in my last patch. It was reported to me that shortly after we
10 integrated this patch. The report was of an oops that took place inside of
11 netif_rx when using the sis900 driver. Looking at my origional patch I noted
12 that there was a spot between the new skb_alloc and the refill_rx_ring label
13 where skb got reassigned to the pointer currently held in the rx_ring for the
14 purposes of receiveing the frame. The result of this is however that the buffer
15 that gets passed to netif_rx (if it is called), then gets placed right back into
16 the rx_ring. So if you receive frames fast enough the skb being processed by
17 the network stack can get corrupted. The reporter is testing out the fix I've
18 written for this below (I'm not near my hardware at the moment to test myself),
19 but I wanted to post it for review ASAP. I'll post test results when I hear
20 them, but I think this is a pretty straightforward fix. It just uses a separate
21 pointer to do the rx operation, so that we don't improperly reassign the pointer
22 that we use to refill the rx ring.
23
24 Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
25 Signed-off-by: Jeff Garzik <jeff@garzik.org>
26 ---
27
28 diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
29 index dea0126..2cb2e15 100644
30 --- a/drivers/net/sis900.c
31 +++ b/drivers/net/sis900.c
32 @@ -1753,6 +1753,7 @@ static int sis900_rx(struct net_device *net_dev)
33 sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE;
34 } else {
35 struct sk_buff * skb;
36 + struct sk_buff * rx_skb;
37
38 pci_unmap_single(sis_priv->pci_dev,
39 sis_priv->rx_ring[entry].bufptr, RX_BUF_SIZE,
40 @@ -1786,10 +1787,10 @@ static int sis900_rx(struct net_device *net_dev)
41 }
42
43 /* give the socket buffer to upper layers */
44 - skb = sis_priv->rx_skbuff[entry];
45 - skb_put(skb, rx_size);
46 - skb->protocol = eth_type_trans(skb, net_dev);
47 - netif_rx(skb);
48 + rx_skb = sis_priv->rx_skbuff[entry];
49 + skb_put(rx_skb, rx_size);
50 + rx_skb->protocol = eth_type_trans(rx_skb, net_dev);
51 + netif_rx(rx_skb);
52
53 /* some network statistics */
54 if ((rx_status & BCAST) == MCAST)

  ViewVC Help
Powered by ViewVC 1.1.20