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

Commit 1c450bdf authored by Grant Grundler's avatar Grant Grundler Committed by Greg Kroah-Hartman
Browse files

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: default avatarAashay Shringarpure <aashay@google.com>
Reported-by: default avatarYi Chou <yich@google.com>
Reported-by: default avatarShervin Oloumi <enlightened@google.com>
Signed-off-by: default avatarGrant Grundler <grundler@chromium.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent e5307704
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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);