summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Egerer <thomas.egerer@secunet.com>2023-10-17 11:10:26 (GMT)
committerThomas Haller <thaller@redhat.com>2023-11-27 19:30:31 (GMT)
commit664f8f1bea7f3c46bdfcd637e694e2c3c627fa7b (patch)
treeff0f3cff5f67c1cc6153f84593c9604902092115
parentc4c22d267117900b9582d5c2e934c107419c9603 (diff)
downloadlibnl-664f8f1bea7f3c46bdfcd637e694e2c3c627fa7b.zip
libnl-664f8f1bea7f3c46bdfcd637e694e2c3c627fa7b.tar.gz
libnl-664f8f1bea7f3c46bdfcd637e694e2c3c627fa7b.tar.bz2
xfrm: clear XFRM_SP_ATTR_TMPL when removing the last template from a policy
Leaving XFRM_SP_ATTR_TMPL active in the mask may not impose a problem but, when removing the last template from a policy, the value signifying attached templates should be cleared. Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
-rw-r--r--lib/xfrm/sp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/xfrm/sp.c b/lib/xfrm/sp.c
index 81c3a0f..5a96ac9 100644
--- a/lib/xfrm/sp.c
+++ b/lib/xfrm/sp.c
@@ -1358,6 +1358,8 @@ void xfrmnl_sp_remove_usertemplate(struct xfrmnl_sp *sp, struct xfrmnl_user_tmpl
if (sp->ce_mask & XFRM_SP_ATTR_TMPL) {
sp->nr_user_tmpl--;
nl_list_del(&utmpl->utmpl_list);
+ if (sp->nr_user_tmpl == 0)
+ sp->ce_mask &= ~XFRM_SP_ATTR_TMPL;
}
}