Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88e07201 authored by Vinicius Costa Gomes's avatar Vinicius Costa Gomes Committed by Greg Kroah-Hartman
Browse files

igb: Fix use-after-free error during reset



[ Upstream commit 7b292608db23ccbbfbfa50cdb155d01725d7a52e ]

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: 7cc6fd4c ("igb: Don't bother clearing Tx buffer_info in igb_clean_tx_ring")
Signed-off-by: default avatarVinicius Costa Gomes <vinicius.gomes@intel.com>
Reported-by: default avatarErez Geva <erez.geva.ext@siemens.com>
Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent a9508e0e
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -4657,6 +4657,8 @@ static void igb_clean_tx_ring(struct igb_ring *tx_ring)
					       DMA_TO_DEVICE);
					       DMA_TO_DEVICE);
		}
		}


		tx_buffer->next_to_watch = NULL;

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