Skip to content

Commit

Permalink
e1000e: prevent null ptr dereference in e1000_tx_queue()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bruce Allan authored and Jeff Kirsher committed Dec 11, 2010
1 parent 073287c commit 36b973d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/e1000e/netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -4629,7 +4629,7 @@ static void e1000_tx_queue(struct e1000_adapter *adapter,

i = tx_ring->next_to_use;

while (count--) {
do {
buffer_info = &tx_ring->buffer_info[i];
tx_desc = E1000_TX_DESC(*tx_ring, i);
tx_desc->buffer_addr = cpu_to_le64(buffer_info->dma);
Expand All @@ -4640,7 +4640,7 @@ static void e1000_tx_queue(struct e1000_adapter *adapter,
i++;
if (i == tx_ring->count)
i = 0;
}
} while (--count > 0);

tx_desc->lower.data |= cpu_to_le32(adapter->txd_cmd);

Expand Down

0 comments on commit 36b973d

Please sign in to comment.