[6.0] 9d8417698 Setup bo->privs in vcl_pipe and add magic checks to priv destruction

Reza Naghibi reza at naghibi.com
Wed Aug 19 13:17:08 UTC 2020


commit 9d8417698bfc51328f854ea843dba18b19c37072
Author: Reza Naghibi <reza at naghibi.com>
Date:   Fri Aug 14 09:44:55 2020 -0400

    Setup bo->privs in vcl_pipe and add magic checks to priv destruction

diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 74b9f8998..04470ab59 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -768,6 +768,7 @@ cnt_pipe(struct worker *wrk, struct req *req)
 	THR_SetBusyobj(bo);
 	bo->sp = req->sp;
 	SES_Ref(bo->sp);
+	VCL_TaskEnter(bo->vcl, bo->privs);
 
 	HTTP_Setup(bo->bereq, bo->ws, bo->vsl, SLT_BereqMethod);
 	http_FilterReq(bo->bereq, req->http, 0);	// XXX: 0 ?
@@ -802,6 +803,7 @@ cnt_pipe(struct worker *wrk, struct req *req)
 	}
 	http_Teardown(bo->bereq);
 	SES_Rel(bo->sp);
+	VCL_TaskLeave(bo->vcl, bo->privs);
 	VBO_ReleaseBusyObj(wrk, &bo);
 	THR_SetBusyobj(NULL);
 	return (nxt);
diff --git a/bin/varnishd/cache/cache_vrt_priv.c b/bin/varnishd/cache/cache_vrt_priv.c
index 4ba0e6261..05aae3f35 100644
--- a/bin/varnishd/cache/cache_vrt_priv.c
+++ b/bin/varnishd/cache/cache_vrt_priv.c
@@ -204,7 +204,9 @@ VCL_TaskLeave(const struct vcl *vcl, struct vrt_privs *privs)
 	CHECK_OBJ_NOTNULL(privs, VRT_PRIVS_MAGIC);
 	VTAILQ_FOREACH_SAFE(vp, &privs->privs, list, vp1) {
 		VTAILQ_REMOVE(&privs->privs, vp, list);
+		CHECK_OBJ_NOTNULL(vp, VRT_PRIV_MAGIC);
 		VRT_priv_fini(vp->priv);
+		ZERO_OBJ(vp, sizeof *vp);
 	}
 	ZERO_OBJ(privs, sizeof *privs);
 }


More information about the varnish-commit mailing list