Skip to content

Commit

Permalink
net: rds: Fix possible NULL-pointer dereference
Browse files Browse the repository at this point in the history
[ Upstream commit f1d95df ]

In rds_rdma_cm_event_handler_cmn() check, if conn pointer exists
before dereferencing it as rdma_set_service_type() argument

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

Fixes: fd261ce ("rds: rdma: update rdma transport for tos")
Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
dTenebrae authored and gregkh committed Oct 6, 2023
1 parent 2f0acb0 commit 51fa660
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions net/rds/rdma_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,13 @@ static int rds_rdma_cm_event_handler_cmn(struct rdma_cm_id *cm_id,
break;

case RDMA_CM_EVENT_ADDR_RESOLVED:
rdma_set_service_type(cm_id, conn->c_tos);
rdma_set_min_rnr_timer(cm_id, IB_RNR_TIMER_000_32);
/* XXX do we need to clean up if this fails? */
ret = rdma_resolve_route(cm_id,
RDS_RDMA_RESOLVE_TIMEOUT_MS);
if (conn) {
rdma_set_service_type(cm_id, conn->c_tos);
rdma_set_min_rnr_timer(cm_id, IB_RNR_TIMER_000_32);
/* XXX do we need to clean up if this fails? */
ret = rdma_resolve_route(cm_id,
RDS_RDMA_RESOLVE_TIMEOUT_MS);
}
break;

case RDMA_CM_EVENT_ROUTE_RESOLVED:
Expand Down

0 comments on commit 51fa660

Please sign in to comment.