]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/siw: Fix immediate work request flush to completion queue
authorBernard Metzler <bmt@zurich.ibm.com>
Mon, 7 Nov 2022 14:50:57 +0000 (15:50 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:17 +0000 (11:41 +0100)
commit6a711fa23d8da8e53de1d7c7794e78b5bfc0ef6e
treefc55639f7551ace8fda390ac6fd241e013991742
parente307d7d9aae8828e01f90bcf88e64599c4c376ab
RDMA/siw: Fix immediate work request flush to completion queue

[ Upstream commit bdf1da5df9da680589a7f74448dd0a94dd3e1446 ]

Correctly set send queue element opcode during immediate work request
flushing in post sendqueue operation, if the QP is in ERROR state.
An undefined ocode value results in out-of-bounds access to an array
for mapping the opcode between siw internal and RDMA core representation
in work completion generation. It resulted in a KASAN BUG report
of type 'global-out-of-bounds' during NFSoRDMA testing.

This patch further fixes a potential case of a malicious user which may
write undefined values for completion queue elements status or opcode,
if the CQ is memory mapped to user land. It avoids the same out-of-bounds
access to arrays for status and opcode mapping as described above.

Fixes: 519268203315 ("rdma/siw: application interface")
Fixes: 09f581643719 ("rdma/siw: completion queue methods")
Reported-by: Olga Kornievskaia <kolga@netapp.com>
Reviewed-by: Tom Talpey <tom@talpey.com>
Signed-off-by: Bernard Metzler <bmt@zurich.ibm.com>
Link: https://lore.kernel.org/r/20221107145057.895747-1-bmt@zurich.ibm.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/sw/siw/siw_cq.c
drivers/infiniband/sw/siw/siw_verbs.c