diff options
author | Bruce Allan <bruce.w.allan@intel.com> | 2010-11-24 02:42:43 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2010-12-11 01:13:41 -0500 |
commit | 36b973df713e1395b79896de667ad7dbb1925fa7 (patch) | |
tree | 087d9cff2e4b786b9af7b62984294e05b0428e41 /drivers/net/e1000e/netdev.c | |
parent | 073287c037083497ebaaf75ead469b769f218615 (diff) |
e1000e: prevent null ptr dereference in e1000_tx_queue()
tx_desc can be dereferenced as a null pointer when count is passed in
as 0.
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Emil Tantilov <emil.s.tantilov@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/e1000e/netdev.c')
-rw-r--r-- | drivers/net/e1000e/netdev.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 393b76d27536..4bf843ac7ea3 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -4629,7 +4629,7 @@ static void e1000_tx_queue(struct e1000_adapter *adapter, | |||
4629 | 4629 | ||
4630 | i = tx_ring->next_to_use; | 4630 | i = tx_ring->next_to_use; |
4631 | 4631 | ||
4632 | while (count--) { | 4632 | do { |
4633 | buffer_info = &tx_ring->buffer_info[i]; | 4633 | buffer_info = &tx_ring->buffer_info[i]; |
4634 | tx_desc = E1000_TX_DESC(*tx_ring, i); | 4634 | tx_desc = E1000_TX_DESC(*tx_ring, i); |
4635 | tx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); | 4635 | tx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); |
@@ -4640,7 +4640,7 @@ static void e1000_tx_queue(struct e1000_adapter *adapter, | |||
4640 | i++; | 4640 | i++; |
4641 | if (i == tx_ring->count) | 4641 | if (i == tx_ring->count) |
4642 | i = 0; | 4642 | i = 0; |
4643 | } | 4643 | } while (--count > 0); |
4644 | 4644 | ||
4645 | tx_desc->lower.data |= cpu_to_le32(adapter->txd_cmd); | 4645 | tx_desc->lower.data |= cpu_to_le32(adapter->txd_cmd); |
4646 | 4646 | ||