aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/cns3xxx
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-03-10 21:59:28 +0000
committerFelix Fietkau <nbd@openwrt.org>2013-03-10 21:59:28 +0000
commit1bb86e38d71b288543b5002637c6a221ba3fd1fd (patch)
treee0064de701f9309d769f4581391258b54a40d054 /target/linux/cns3xxx
parentb019b3bb2f583a067586d9ec12e24a792ca603b8 (diff)
downloadmaster-187ad058-1bb86e38d71b288543b5002637c6a221ba3fd1fd.tar.gz
master-187ad058-1bb86e38d71b288543b5002637c6a221ba3fd1fd.tar.bz2
master-187ad058-1bb86e38d71b288543b5002637c6a221ba3fd1fd.zip
cns3xxx: prevent the ethernet driver from accessing uninitialized dma descriptor entries
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35950 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/cns3xxx')
-rw-r--r--target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c b/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c
index 7a5c44cad6..c9040b1647 100644
--- a/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c
+++ b/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c
@@ -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;