aboutsummaryrefslogtreecommitdiffstats
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
commitee2b511e1f232487540c79dc120c097c5bd49a37 (patch)
treec5eda09f34963d5218e15538f205a81f3a03dd98
parentd22ac8d8fb6e7b62d1ddf2f19ae61ec6c82222c0 (diff)
downloadupstream-ee2b511e1f232487540c79dc120c097c5bd49a37.tar.gz
upstream-ee2b511e1f232487540c79dc120c097c5bd49a37.tar.bz2
upstream-ee2b511e1f232487540c79dc120c097c5bd49a37.zip
cns3xxx: prevent the ethernet driver from accessing uninitialized dma descriptor entries
SVN-Revision: 35950
-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;