From 47b4886e12dc31c71c24c71ffa3aa2a01ec094af Mon Sep 17 00:00:00 2001 From: Cyril Bordage Date: Fri, 30 May 2025 18:07:08 +0200 Subject: [PATCH] LU-18897 o2iblnd: NULL pointer dereference When the network is flapping, we could get an RDMA_CM_EVENT_UNREACHABLE event before conn is created, so we should check the value first. Test-Parameters: trivial Signed-off-by: Cyril Bordage Change-Id: I8d9777370b927c28ee438687de596e498d64bb07 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/59498 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Frank Sehr Reviewed-by: Serguei Smirnov Reviewed-by: Oleg Drokin --- lnet/klnds/o2iblnd/o2iblnd_cb.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lnet/klnds/o2iblnd/o2iblnd_cb.c b/lnet/klnds/o2iblnd/o2iblnd_cb.c index b362c0d..556dddc 100644 --- a/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -3430,6 +3430,12 @@ kiblnd_cm_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event) case RDMA_CM_EVENT_UNREACHABLE: conn = cmid->context; + + /* In case we have a flapping network, we can get this event + * before conn is created */ + if (conn == NULL) + return -ENETDOWN; + CNETERR("%s: UNREACHABLE %d cm_id %p conn %p ibc_state: %d\n", libcfs_nidstr(&conn->ibc_peer->ibp_nid), event->status, cmid, conn, conn->ibc_state); -- 1.8.3.1