Commit 271bfcfb authored by Daniil Dulov's avatar Daniil Dulov Committed by Leon Romanovsky

RDMA/siw: Fix potential page_array out of range access

When seg is equal to MAX_ARRAY, the loop should break, otherwise
it will result in out of range access.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: b9be6f18 ("rdma/siw: transmit path")
Signed-off-by: default avatarDaniil Dulov <d.dulov@aladdin.ru>
Link: https://lore.kernel.org/r/20230227091751.589612-1-d.dulov@aladdin.ruSigned-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent c874ad87
...@@ -558,7 +558,7 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s) ...@@ -558,7 +558,7 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, struct socket *s)
data_len -= plen; data_len -= plen;
fp_off = 0; fp_off = 0;
if (++seg > (int)MAX_ARRAY) { if (++seg >= (int)MAX_ARRAY) {
siw_dbg_qp(tx_qp(c_tx), "to many fragments\n"); siw_dbg_qp(tx_qp(c_tx), "to many fragments\n");
siw_unmap_pages(iov, kmap_mask, seg-1); siw_unmap_pages(iov, kmap_mask, seg-1);
wqe->processed -= c_tx->bytes_unsent; wqe->processed -= c_tx->bytes_unsent;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment