Whamcloud - gitweb
LU-4585 out: memset(ta, 0) will cause memory leak 04/9804/2
authorwang di <di.wang@intel.com>
Wed, 26 Mar 2014 16:01:58 +0000 (09:01 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 27 Mar 2014 14:43:01 +0000 (14:43 +0000)
thandle_exec_args should not be memset to 0 in
out_trans_start or out_handle, otherwise ta_args
will never be released.

Signed-off-by: wang di <di.wang@intel.com>
Change-Id: I3b6a8dc8c62af743015f6022afdeda14264574c8
Reviewed-on: http://review.whamcloud.com/9804
Tested-by: Jenkins
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/target/out_handler.c

index 3cb6e83..b7dfd58 100644 (file)
@@ -1299,7 +1299,7 @@ struct tgt_handler *out_handler_find(__u32 opc)
 static int out_tx_start(const struct lu_env *env, struct dt_device *dt,
                        struct thandle_exec_args *ta, struct obd_export *exp)
 {
-       memset(ta, 0, sizeof(*ta));
+       ta->ta_argno = 0;
        ta->ta_handle = dt_trans_create(env, dt);
        if (IS_ERR(ta->ta_handle)) {
                int rc;
@@ -1346,6 +1346,8 @@ static int out_trans_stop(const struct lu_env *env,
                        ta->ta_args[i]->object = NULL;
                }
        }
+       ta->ta_handle = NULL;
+       ta->ta_argno = 0;
 
        return rc;
 }
@@ -1483,7 +1485,6 @@ int out_handle(struct tgt_session_info *tsi)
        tti->tti_u.update.tti_update_reply = reply;
        tti->tti_mult_trans = !req_is_replay(tgt_ses_req(tsi));
 
-       memset(ta, 0, sizeof(*ta));
        /* Walk through updates in the request to execute them synchronously */
        for (i = 0; i < count; i++) {
                struct tgt_handler      *h;