diff options
author | Thomas Haller <thaller@redhat.com> | 2019-02-20 14:53:27 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-02-22 09:58:09 +0100 |
commit | a4cff10ceb3dc98c2924a63c1cb5e5b3dde5dee7 (patch) | |
tree | 89a0d7bacf9863a6775a3a8fc4f7d58a267d418f | |
parent | 106e4ebc130ebfb8727cf394239c5bc73d6f59d7 (diff) | |
download | NetworkManager-a4cff10ceb3dc98c2924a63c1cb5e5b3dde5dee7.tar.gz |
platform: fix error handling for creating nlmsg in do_request_all_no_delayed_actions()
In practice, we don't fail to create the nlmsg, because in glib
malloc() cannot fail and we always create large enough buffers.
Anyway, handle the error correctly, and reduce the in-progress
counter again.
-rw-r--r-- | src/platform/nm-linux-platform.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 09f75a80cf..77a83791fa 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -5248,13 +5248,23 @@ do_request_all_no_delayed_actions (NMPlatform *platform, DelayedActionType actio }; nle = nlmsg_append (nlmsg, &gmsg, sizeof (gmsg), NLMSG_ALIGNTO); } + if (nle < 0) - continue; + goto next_after_fail; - if (_nl_send_nlmsg (platform, nlmsg, NULL, NULL, DELAYED_ACTION_RESPONSE_TYPE_REFRESH_ALL_IN_PROGRESS, out_refresh_all_in_progress) < 0) { - nm_assert (*out_refresh_all_in_progress > 0); - *out_refresh_all_in_progress -= 1; - } + if (_nl_send_nlmsg (platform, + nlmsg, + NULL, + NULL, + DELAYED_ACTION_RESPONSE_TYPE_REFRESH_ALL_IN_PROGRESS, + out_refresh_all_in_progress) < 0) + goto next_after_fail; + + continue; + +next_after_fail: + nm_assert (*out_refresh_all_in_progress > 0); + *out_refresh_all_in_progress -= 1; } } |