From eee15fff4005c3a7c7dffba8776a96c050464b1a Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 27 Jun 2021 02:30:52 +0900 Subject: [PATCH] sd-netlink: do not trigger assertion by calling socket_broadcast_group_unref() with an arbitrary group number socket_broadcast_group_unref() is only called in netlink_slot_disconnect(), so the assertion should not be triggered as the match slot was successfully created. But, we usually design `_ref/unref()` functions as they can be called for any inputs. So, let's also follow the design rule here. --- src/libsystemd/sd-netlink/netlink-socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsystemd/sd-netlink/netlink-socket.c b/src/libsystemd/sd-netlink/netlink-socket.c index a29210e1ce..21ec00cca0 100644 --- a/src/libsystemd/sd-netlink/netlink-socket.c +++ b/src/libsystemd/sd-netlink/netlink-socket.c @@ -160,8 +160,8 @@ int socket_broadcast_group_unref(sd_netlink *nl, unsigned group) { assert(nl); n_ref = broadcast_group_get_ref(nl, group); - - assert(n_ref > 0); + if (n_ref == 0) + return 0; n_ref--; -- 2.25.1