Skip to contentSkip to conversation

atm: iphase: off by one in rx_pkt()

PATCH Applied Dan Carpenter 2 participants 2 messages May 27, 2016 – May 31, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 atm: iphase: off by one in rx_pkt()

The iadev->rx_open[] array holds "iadev->num_vc" pointers (this code assumes that pointers are 32 bits). So the > here should be >= or else we could end up reading a garbage pointer from one element beyond the end of the array.

drivers/atm/iphase.c +1 -1
index 7d00f29..f86e318 100644
@@ -1128,7 +1128,7 @@ static int rx_pkt(struct atm_dev *dev)
 	/* make the ptr point to the corresponding buffer desc entry */  
 	buf_desc_ptr += desc;	  
         if (!desc || (desc > iadev->num_rx_desc) || 
-                      ((buf_desc_ptr->vc_index & 0xffff) > iadev->num_vc)) { 
+                      ((buf_desc_ptr->vc_index & 0xffff) >= iadev->num_vc)) { 
             free_desc(dev, desc);
             IF_ERR(printk("IA: bad descriptor desc = %d \n", desc);)
             return -1;
maintainer Applied
#1 lore raw

From: Dan Carpenter <[email protected]>
Date: Fri, 27 May 2016 13:34:35 +0300

Quoted 6 lines

The iadev->rx_open[] array holds "iadev->num_vc" pointers (this code assumes that pointers are 32 bits). So the > here should be >= or else we could end up reading a garbage pointer from one element beyond the end of the array.

Applied.