summaryrefslogtreecommitdiff
path: root/lib/route
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-03-17 00:25:53 +0100
committerThomas Haller <thaller@redhat.com>2022-03-17 00:26:46 +0100
commit8111933bf5c6761644ef52905efb44dd867812d6 (patch)
tree8b4aeb641e4c2e96b4da272fcbca4b51289feb8e /lib/route
parent4f5c846b2e36b2afbc33c4d0cc4a3679c11240a8 (diff)
downloadlibnl-8111933bf5c6761644ef52905efb44dd867812d6.tar.gz
route: assert that "rtnl_link_info_ops" refcount does not drop below zero
Diffstat (limited to 'lib/route')
-rw-r--r--lib/route/link/api.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/route/link/api.c b/lib/route/link/api.c
index 8bbe3d9a..12ddee97 100644
--- a/lib/route/link/api.c
+++ b/lib/route/link/api.c
@@ -104,6 +104,7 @@ void rtnl_link_info_ops_put(struct rtnl_link_info_ops *ops)
return;
nl_write_lock(&info_lock);
+ _nl_assert(ops->io_refcnt > 0);
ops->io_refcnt--;
nl_write_unlock(&info_lock);
}
@@ -164,6 +165,7 @@ int rtnl_link_unregister_info(struct rtnl_link_info_ops *ops)
nl_list_for_each_entry(t, &info_ops, io_list) {
if (t == ops) {
+ _nl_assert(t->io_refcnt >= 0);
if (t->io_refcnt > 0) {
err = -NLE_BUSY;
goto errout;