summaryrefslogtreecommitdiff
path: root/src/network/networkd-nexthop.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-05-17 15:23:57 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-05-18 20:40:50 +0900
commitce9388d72a710ffc4840572fecdfe7d9c0be0956 (patch)
treea5d5b99ef1e4401826060cac09e8392378ab2095 /src/network/networkd-nexthop.c
parentc54cfef3968613f9e86e76a3337148360e20150e (diff)
downloadsystemd-ce9388d72a710ffc4840572fecdfe7d9c0be0956.tar.gz
network: fix possible message counter double decrement
When after_configure() for a request fails, then the request is not removed from the queue at that time, and the link enters to failed state. After that, if the link is reconfigured or its carrier is lost, then the request is dropped from the queue, and the message_counter is decreased. However, the counter is already or will be also decreased when the corresponding netlink reply is received. So, the counter is decreased twice.
Diffstat (limited to 'src/network/networkd-nexthop.c')
-rw-r--r--src/network/networkd-nexthop.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/network/networkd-nexthop.c b/src/network/networkd-nexthop.c
index 5c6c58356c..013bddf30c 100644
--- a/src/network/networkd-nexthop.c
+++ b/src/network/networkd-nexthop.c
@@ -751,6 +751,9 @@ int request_process_nexthop(Request *req) {
if (r < 0)
return r;
+ /* To prevent a double decrement on failure in after_configure(). */
+ req->message_counter = NULL;
+
if (req->after_configure) {
r = req->after_configure(req, ret);
if (r < 0)