Mailing List Archive

[master] c1aa3c20b Proper locking around n_backend. Found by Coverity.
commit c1aa3c20b4377e1eedb545fdf15edd60c4b72c9a
Author: Poul-Henning Kamp <phk@FreeBSD.org>
Date: Mon Dec 11 13:45:34 2023 +0000

Proper locking around n_backend. Found by Coverity.

diff --git a/vmod/vmod_directors.c b/vmod/vmod_directors.c
index 2334e0c14..44b98217f 100644
--- a/vmod/vmod_directors.c
+++ b/vmod/vmod_directors.c
@@ -94,9 +94,11 @@ vdir_release(struct vdir *vd)

CHECK_OBJ_NOTNULL(vd, VDIR_MAGIC);

+ vdir_wrlock(vd);
for (u = 0; u < vd->n_backend; u++)
VRT_Assign_Backend(&vd->backend[u], NULL);
vd->n_backend = 0;
+ vdir_unlock(vd);
}

void
diff --git a/vmod/vmod_directors_round_robin.c b/vmod/vmod_directors_round_robin.c
index 015e060da..f2ee59f04 100644
--- a/vmod/vmod_directors_round_robin.c
+++ b/vmod/vmod_directors_round_robin.c
@@ -90,9 +90,9 @@ vmod_rr_resolve(VRT_CTX, VCL_BACKEND dir)
break;
}
rr->nxt = nxt;
- vdir_unlock(rr->vd);
if (u == rr->vd->n_backend)
be = NULL;
+ vdir_unlock(rr->vd);
return (be);
}

_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit