iw_cxgb4: Fix potential NULL dereference in c4iw_fill_res_cm_id_entry()
authorDan Carpenter <error27@gmail.com>
Tue, 14 Feb 2023 15:43:38 +0000 (18:43 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:39:42 +0000 (09:39 +0100)
commit76e0396313c79ecd0df44ee3c18745cfac52b3e6
treed8ba0366f4b3327d666d7200dcb87565a87b81b0
parent3df71bb7e8ad6b8ac2f6e78abffa03033b94b894
iw_cxgb4: Fix potential NULL dereference in c4iw_fill_res_cm_id_entry()

[ Upstream commit 4ca446b127c568b59cb8d9748b6f70499624bb18 ]

This condition needs to match the previous "if (epcp->state == LISTEN) {"
exactly to avoid a NULL dereference of either "listen_ep" or "ep". The
problem is that "epcp" has been re-assigned so just testing
"if (epcp->state == LISTEN) {" a second time is not sufficient.

Fixes: 116aeb887371 ("iw_cxgb4: provide detailed provider-specific CM_ID information")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/Y+usKuWIKr4dimZh@kili
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/cxgb4/restrack.c