diff options
author | Grant Grundler <grundler@chromium.org> | 2022-05-09 19:28:26 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-05-25 09:14:37 +0200 |
commit | 1c450bdf2e8cdc71094e10de36bedf34535428fb (patch) | |
tree | e7468e571cdab5334ba21740572a2a8f4a6690a8 /drivers/net | |
parent | e5307704c4adb525185ef32d9fc626c7ac5c4631 (diff) | |
download | linux-stable-1c450bdf2e8cdc71094e10de36bedf34535428fb.tar.gz linux-stable-1c450bdf2e8cdc71094e10de36bedf34535428fb.tar.bz2 linux-stable-1c450bdf2e8cdc71094e10de36bedf34535428fb.zip |
net: atlantic: verify hw_head_ lies within TX buffer ring
[ Upstream commit 2120b7f4d128433ad8c5f503a9584deba0684901 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c index 2ad3fa6316ce..cb5954eeb409 100644 --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c @@ -674,6 +674,13 @@ static int hw_atl_b0_hw_ring_tx_head_update(struct aq_hw_s *self, err = -ENXIO; goto err_exit; } + + /* Validate that the new hw_head_ is reasonable. */ + if (hw_head_ >= ring->size) { + err = -ENXIO; + goto err_exit; + } + ring->hw_head = hw_head_; err = aq_hw_err_from_flags(self); |