Skip to content

Commit 2120b7f

Browse files
grundlerchromiumdavem330
authored andcommitted
net: atlantic: verify hw_head_ lies within TX buffer ring
Bounds check hw_head index provided by NIC to verify it lies within the TX buffer ring. Reported-by: Aashay Shringarpure <aashay@google.com> Reported-by: Yi Chou <yich@google.com> Reported-by: Shervin Oloumi <enlightened@google.com> Signed-off-by: Grant Grundler <grundler@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6aecbba commit 2120b7f

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • drivers/net/ethernet/aquantia/atlantic/hw_atl

drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,13 @@ int hw_atl_b0_hw_ring_tx_head_update(struct aq_hw_s *self,
889889
err = -ENXIO;
890890
goto err_exit;
891891
}
892+
893+
/* Validate that the new hw_head_ is reasonable. */
894+
if (hw_head_ >= ring->size) {
895+
err = -ENXIO;
896+
goto err_exit;
897+
}
898+
892899
ring->hw_head = hw_head_;
893900
err = aq_hw_err_from_flags(self);
894901

0 commit comments

Comments
 (0)