]> 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>
Fri, 4 Oct 2024 14:29:31 +0000 (16:29 +0200)
commit01b9be936ee8839ab9f83a7e84ee02ac6c8303c4
tree00e528a595f3d480321b19ca8d71537d57b1a61b
parenteffc10f00cf85fed8b96b89a57b252fc3ac7236c
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