cns3xxx: prevent the ethernet driver from accessing uninitialized dma descriptor...
authorFelix Fietkau <nbd@openwrt.org>
Sun, 10 Mar 2013 21:59:28 +0000 (21:59 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 10 Mar 2013 21:59:28 +0000 (21:59 +0000)
SVN-Revision: 35950

target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c

index 7a5c44cad6c99b3de9cb4cd9f3ee045fd637aed2..c9040b1647f1dc675f238f401089112ba7d76823 100644 (file)
@@ -619,8 +619,9 @@ static int eth_poll(struct napi_struct *napi, int budget)
        unsigned int length;
        unsigned int i = rx_ring->cur_index;
        struct rx_desc *desc = &(rx_ring)->desc[i];
+       unsigned int alloc_count = rx_ring->alloc_count;
 
-       while (desc->cown) {
+       while (desc->cown && alloc_count + received < RX_DESCS - 1) {
                struct sk_buff *skb;
                int reserve = SKB_HEAD_ALIGN;