staging: lustre: lnet: Do not drop message when shutting down LNet
authorDoug Oucharek <doug.s.oucharek@intel.com>
Tue, 16 Aug 2016 20:19:29 +0000 (16:19 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Aug 2016 13:57:39 +0000 (15:57 +0200)
There is a case in lnet_parse() where we discover that LNet
is shutting down but we continue to use the NI when we drop the
message and end up calling ko2iblnd_check_send_locked() which tries to
allocate from the Tx pool which has been cleaned up already.
This triggers a NULL pointer dereference.

This fix just returns from lnet_parse() when we disover LNet is
shutting down.

Signed-off-by: Doug Oucharek <doug.s.oucharek@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8106
Reviewed-on: http://review.whamcloud.com/19993
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/lnet/lib-move.c

index 6a3f2e116ff61721a40235e01747213ff4f72309..5598fa8764269e34290b7f7c6c7cff87d5a9b836 100644 (file)
@@ -2002,6 +2002,9 @@ lnet_parse(lnet_ni_t *ni, lnet_hdr_t *hdr, lnet_nid_t from_nid,
                       libcfs_nid2str(from_nid), libcfs_nid2str(src_nid),
                       lnet_msgtyp2str(type), rc);
                lnet_msg_free(msg);
+               if (rc == -ESHUTDOWN)
+                       /* We are shutting down. Don't do anything more */
+                       return 0;
                goto drop;
        }