staging: lustre: fix failure handle of create reply
authorLiang Zhen <liang.zhen@intel.com>
Mon, 15 Feb 2016 15:25:47 +0000 (10:25 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Feb 2016 22:29:23 +0000 (14:29 -0800)
error handler of lnet_create_reply_msg() didn't release lnet_res_lock
if lnet_msg_alloc() failed.
It can be fixed by moving validation check of msg out from lock.

Signed-off-by: Liang Zhen <liang.zhen@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2745
Reviewed-on: http://review.whamcloud.com/5542
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/lnet/lib-move.c

index ab56e7faca3a0a7e787336c500eef08063effc6a..1e1e63c731213d4b41d2324a2b456b5b4dd448f2 100644 (file)
@@ -2187,17 +2187,17 @@ lnet_create_reply_msg(lnet_ni_t *ni, lnet_msg_t *getmsg)
        LASSERT(!getmsg->msg_target_is_router);
        LASSERT(!getmsg->msg_routing);
 
-       cpt = lnet_cpt_of_cookie(getmd->md_lh.lh_cookie);
-       lnet_res_lock(cpt);
-
-       LASSERT(getmd->md_refcount > 0);
-
        if (!msg) {
                CERROR("%s: Dropping REPLY from %s: can't allocate msg\n",
                       libcfs_nid2str(ni->ni_nid), libcfs_id2str(peer_id));
                goto drop;
        }
 
+       cpt = lnet_cpt_of_cookie(getmd->md_lh.lh_cookie);
+       lnet_res_lock(cpt);
+
+       LASSERT(getmd->md_refcount > 0);
+
        if (!getmd->md_threshold) {
                CERROR("%s: Dropping REPLY from %s for inactive MD %p\n",
                       libcfs_nid2str(ni->ni_nid), libcfs_id2str(peer_id),
This page took 0.026068 seconds and 5 git commands to generate.