1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00

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.
This commit is contained in:
Yu Watanabe 2021-05-17 15:23:57 +09:00
parent c54cfef396
commit ce9388d72a
5 changed files with 15 additions and 0 deletions

View File

@ -1149,6 +1149,9 @@ int request_process_address(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)

View File

@ -479,6 +479,9 @@ int request_process_neighbor(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)

View File

@ -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)

View File

@ -1622,6 +1622,9 @@ int request_process_route(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) {
assert(n_routes > 0);

View File

@ -814,6 +814,9 @@ int request_process_routing_policy_rule(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)