Skip to content

Commit e12934d

Browse files
Colin Ian Kingdavem330
authored andcommitted
cxgb4: fix signed wrap around when decrementing index idx
Change predecrement compare to post decrement compare to avoid an unsigned integer wrap-around comparison when decrementing idx in the while loop. For example, when idx is zero, the current situation will predecrement idx in the while loop, wrapping idx to the maximum signed integer and cause out of bounds reads on rxq_info->msix_tbl[idx]. Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c7b9e63 commit e12934d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ int request_msix_queue_irqs_uld(struct adapter *adap, unsigned int uld_type)
367367
}
368368
return 0;
369369
unwind:
370-
while (--idx >= 0) {
370+
while (idx-- > 0) {
371371
bmap_idx = rxq_info->msix_tbl[idx];
372372
free_msix_idx_in_bmap(adap, bmap_idx);
373373
free_irq(adap->msix_info_ulds[bmap_idx].vec,

0 commit comments

Comments
 (0)