Whamcloud - gitweb
LU-17708 lnet: update kfi and o2ib to handle NULL lnet_msg 77/54677/7
authorShaun Tancheff <shaun.tancheff@hpe.com>
Sun, 9 Jun 2024 23:59:43 +0000 (06:59 +0700)
committerOleg Drokin <green@whamcloud.com>
Wed, 19 Jun 2024 01:10:11 +0000 (01:10 +0000)
Handle the handle NULL lnet_msg cases in the lnd_recf() handlers
of kfi and o2ib lnds.

HPE-bug-id: LUS-12245
Test-Parameters: trivial
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: Ia0a8957653353380ef77c9686a020284db0e460c
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54677
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/klnds/kfilnd/kfilnd.c
lnet/klnds/o2iblnd/o2iblnd_cb.c

index 09d2f4b..44ba7ef 100644 (file)
@@ -268,9 +268,12 @@ static int kfilnd_recv(struct lnet_ni *ni, void *private, struct lnet_msg *msg,
        case KFILND_MSG_IMMEDIATE:
                nob = offsetof(struct kfilnd_msg, proto.immed.payload[rlen]);
                if (nob > tn->tn_rx_msg.length) {
+                       char *nid = "unknown";
+
+                       if (msg)
+                               nid = libcfs_nidstr(&msg->msg_hdr.src_nid);
                        CERROR("Immediate message from %s too big: %d(%lu)\n",
-                              libcfs_nidstr(&msg->msg_hdr.src_nid),
-                              nob, tn->tn_rx_msg.length);
+                               nid, nob, tn->tn_rx_msg.length);
                        return -EPROTO;
                }
                tn->tn_nob = nob;
index 16e4625..45c6de3 100644 (file)
@@ -1974,9 +1974,12 @@ kiblnd_recv(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg,
        case IBLND_MSG_IMMEDIATE:
                nob = offsetof(struct kib_msg, ibm_u.immediate.ibim_payload[rlen]);
                if (nob > rx->rx_nob) {
+                       char *nid = "unknown";
+
+                       if (lntmsg)
+                               nid = libcfs_nidstr(&lntmsg->msg_hdr.src_nid);
                        CERROR("Immediate message from %s too big: %d(%d)\n",
-                              libcfs_nidstr(&lntmsg->msg_hdr.src_nid),
-                              nob, rx->rx_nob);
+                              nid, nob, rx->rx_nob);
                        rc = -EPROTO;
                        break;
                }
@@ -1992,7 +1995,10 @@ kiblnd_recv(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg,
        case IBLND_MSG_PUT_REQ: {
                struct kib_msg  *txmsg;
                struct kib_rdma_desc *rd;
-               struct lnet_libmd *msg_md = lntmsg->msg_md;
+               struct lnet_libmd *msg_md = NULL;
+
+               if (lntmsg)
+                       msg_md = lntmsg->msg_md;
 
                ibprm_cookie = rxmsg->ibm_u.putreq.ibprm_cookie;
                if (mlen == 0) {