[master] 8b3ac69c0 panic: do not dump session attrs for magic mismatch

Nils Goroll nils.goroll at uplex.de
Mon Oct 5 15:04:06 UTC 2020


commit 8b3ac69c0d4e4eef76d2895b4113787ae5dfd2db
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Oct 5 16:56:12 2020 +0200

    panic: do not dump session attrs for magic mismatch

diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 61bde5f43..253fa674a 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -559,12 +559,19 @@ pan_sess(struct vsb *vsb, const struct sess *sp)
 		return;
 	VSB_indent(vsb, 2);
 	PAN_CheckMagic(vsb, sp, SESS_MAGIC);
-	xp = XPORT_ByNumber(sp->sattr[SA_TRANSPORT]);
 	VSB_printf(vsb, "fd = %d, vxid = %u,\n",
 	    sp->fd, VXID(sp->vxid));
 	VSB_printf(vsb, "t_open = %f,\n", sp->t_open);
 	VSB_printf(vsb, "t_idle = %f,\n", sp->t_idle);
+
+	if (! VALID_OBJ(sp, SESS_MAGIC)) {
+		VSB_indent(vsb, -2);
+		VSB_cat(vsb, "},\n");
+		return;
+	}
+
 	WS_Panic(sp->ws, vsb);
+	xp = XPORT_ByNumber(sp->sattr[SA_TRANSPORT]);
 	VSB_printf(vsb, "transport = %s",
 	    xp == NULL ? "<none>" : xp->name);
 	if (xp != NULL && xp->sess_panic != NULL) {
@@ -575,6 +582,7 @@ pan_sess(struct vsb *vsb, const struct sess *sp)
 		VSB_cat(vsb, "}");
 	}
 	VSB_cat(vsb, "\n");
+
 	// duplicated below, remove ?
 	ci = SES_Get_String_Attr(sp, SA_CLIENT_IP);
 	cp = SES_Get_String_Attr(sp, SA_CLIENT_PORT);


More information about the varnish-commit mailing list