Whamcloud - gitweb
LU-2167 ptlrpc: Fix use after free in ptlrpcd on termination
authorOleg Drokin <green@whamcloud.com>
Sat, 13 Oct 2012 16:51:35 +0000 (12:51 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 23 Oct 2012 23:12:05 +0000 (19:12 -0400)
Should not use pc after signalling completion of its use
since it will be freed later.

Change-Id: Id20e8d188fea77f23a52e9a374e7e5e84fe3ad4b
Signed-off-by: Oleg Drokin <green@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/4264
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
lustre/ptlrpc/ptlrpcd.c

index fbb03b2..861e3cd 100644 (file)
@@ -477,12 +477,14 @@ static int ptlrpcd(void *arg)
         if (!cfs_list_empty(&set->set_requests))
                 ptlrpc_set_wait(set);
         lu_context_fini(&env.le_ctx);
-        cfs_complete(&pc->pc_finishing);
 
         cfs_clear_bit(LIOD_START, &pc->pc_flags);
         cfs_clear_bit(LIOD_STOP, &pc->pc_flags);
         cfs_clear_bit(LIOD_FORCE, &pc->pc_flags);
         cfs_clear_bit(LIOD_BIND, &pc->pc_flags);
+
+        cfs_complete(&pc->pc_finishing);
+
         return 0;
 }