]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
RDMA/rtrs-clt: Reset cid to con_num - 1 to stay in bounds
authorMd Haris Iqbal <haris.iqbal@ionos.com>
Wed, 21 Aug 2024 11:22:12 +0000 (13:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2024 13:11:01 +0000 (15:11 +0200)
commit0429a4e972082e3a2351da414b1c017daaf8aed2
tree2b1accdd125a0ba73aa3bdfdd42478a9d9a064c9
parentc84af5f5f2ea013087572c8e157e6b87c91a7a22
RDMA/rtrs-clt: Reset cid to con_num - 1 to stay in bounds

[ Upstream commit 3e4289b29e216a55d08a89e126bc0b37cbad9f38 ]

In the function init_conns(), after the create_con() and create_cm() for
loop if something fails. In the cleanup for loop after the destroy tag, we
access out of bound memory because cid is set to clt_path->s.con_num.

This commits resets the cid to clt_path->s.con_num - 1, to stay in bounds
in the cleanup loop later.

Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality")
Signed-off-by: Md Haris Iqbal <haris.iqbal@ionos.com>
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Grzegorz Prajsner <grzegorz.prajsner@ionos.com>
Link: https://patch.msgid.link/20240821112217.41827-7-haris.iqbal@ionos.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/ulp/rtrs/rtrs-clt.c