Skip to content

Commit

Permalink
igb: Fix use-after-free error during reset
Browse files Browse the repository at this point in the history
[ Upstream commit 7b29260 ]

Cleans the next descriptor to watch (next_to_watch) when cleaning the
TX ring.

Failure to do so can cause invalid memory accesses. If igb_poll() runs
while the controller is reset this can lead to the driver try to free
a skb that was already freed.

(The crash is harder to reproduce with the igb driver, but the same
potential problem exists as the code is identical to igc)

Fixes: 7cc6fd4 ("igb: Don't bother clearing Tx buffer_info in igb_clean_tx_ring")
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Reported-by: Erez Geva <erez.geva.ext@siemens.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
vcgomes authored and gregkh committed Jul 28, 2021
1 parent ea5e36b commit 8e24c12
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/intel/igb/igb_main.c
Expand Up @@ -4835,6 +4835,8 @@ static void igb_clean_tx_ring(struct igb_ring *tx_ring)
DMA_TO_DEVICE);
}

tx_buffer->next_to_watch = NULL;

/* move us one more past the eop_desc for start of next pkt */
tx_buffer++;
i++;
Expand Down

0 comments on commit 8e24c12

Please sign in to comment.