mirror of
https://github.com/systemd/systemd.git
synced 2026-08-02 22:20:20 +00:00
network: fix use-after-free in {address,route}_remove_and_cancel()
Fixes #31485.
This commit is contained in:
committed by
Luca Boccassi
parent
52672db3f8
commit
7036d472d0
@@ -1180,8 +1180,8 @@ int address_remove(Address *address, Link *link) {
|
||||
}
|
||||
|
||||
int address_remove_and_cancel(Address *address, Link *link) {
|
||||
_cleanup_(request_unrefp) Request *req = NULL;
|
||||
bool waiting = false;
|
||||
Request *req;
|
||||
|
||||
assert(address);
|
||||
assert(link);
|
||||
@@ -1193,6 +1193,7 @@ int address_remove_and_cancel(Address *address, Link *link) {
|
||||
/* Cancel the request for the address. If the request is already called but we have not received the
|
||||
* notification about the request, then explicitly remove the address. */
|
||||
if (address_get_request(link, address, &req) >= 0) {
|
||||
request_ref(req); /* avoid the request freed by request_detach() */
|
||||
waiting = req->waiting_reply;
|
||||
request_detach(req);
|
||||
address_cancel_requesting(address);
|
||||
|
||||
@@ -600,8 +600,8 @@ int route_remove(Route *route, Manager *manager) {
|
||||
}
|
||||
|
||||
int route_remove_and_cancel(Route *route, Manager *manager) {
|
||||
_cleanup_(request_unrefp) Request *req = NULL;
|
||||
bool waiting = false;
|
||||
Request *req;
|
||||
|
||||
assert(route);
|
||||
assert(manager);
|
||||
@@ -612,6 +612,7 @@ int route_remove_and_cancel(Route *route, Manager *manager) {
|
||||
/* Cancel the request for the route. If the request is already called but we have not received the
|
||||
* notification about the request, then explicitly remove the route. */
|
||||
if (route_get_request(manager, route, &req) >= 0) {
|
||||
request_ref(req); /* avoid the request freed by request_detach() */
|
||||
waiting = req->waiting_reply;
|
||||
request_detach(req);
|
||||
route_cancel_requesting(route);
|
||||
|
||||
Reference in New Issue
Block a user