1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-10 05:18:17 +03:00

network: netdev: increment reference counter on request

Otherwise, it may be freed on reload.
This commit is contained in:
Yu Watanabe 2022-02-15 03:26:16 +09:00
parent d708bc6e4f
commit efa7b8adde
2 changed files with 3 additions and 2 deletions

View File

@ -732,13 +732,13 @@ int link_request_stacked_netdev(Link *link, NetDev *netdev) {
if (netdev_get_create_type(netdev) == NETDEV_CREATE_STACKED) {
link->stacked_netdevs_created = false;
r = link_queue_request(link, REQUEST_TYPE_NETDEV_STACKED, netdev, false,
r = link_queue_request(link, REQUEST_TYPE_NETDEV_STACKED, netdev_ref(netdev), true,
&link->create_stacked_netdev_messages,
link_create_stacked_netdev_handler,
NULL);
} else {
link->stacked_netdevs_after_configured_created = false;
r = link_queue_request(link, REQUEST_TYPE_NETDEV_STACKED, netdev, false,
r = link_queue_request(link, REQUEST_TYPE_NETDEV_STACKED, netdev_ref(netdev), true,
&link->create_stacked_netdev_after_configured_messages,
link_create_stacked_netdev_after_configured_handler,
NULL);

View File

@ -47,6 +47,7 @@ static void request_free_object(RequestType type, void *object) {
neighbor_free(object);
break;
case REQUEST_TYPE_NETDEV_STACKED:
netdev_unref(object);
break;
case REQUEST_TYPE_NEXTHOP:
nexthop_free(object);