diff options
author | Felix Fietkau <nbd@nbd.name> | 2022-08-25 21:09:24 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2022-08-25 21:13:35 +0200 |
commit | 76d2d41b7355e02f95fbfa79affbd232fb090595 (patch) | |
tree | 1f7756be7a86a513b849d6bcb9769e5274b57978 /interface.c | |
parent | bfa039c414bc6613cc5361aaf5fa6baf5fa0264b (diff) | |
download | netifd-76d2d41b7355e02f95fbfa79affbd232fb090595.tar.gz |
interface: fix use-after-free bug when rewriting resolv.conf
After the call to interface_handle_config_change, the iface pointer will no
longer be valid if the interface has been deleted from the config
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'interface.c')
-rw-r--r-- | interface.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/interface.c b/interface.c index 255ce84..89654f9 100644 --- a/interface.c +++ b/interface.c @@ -771,12 +771,13 @@ interface_proto_event_cb(struct interface_proto_state *state, enum interface_pro netifd_log_message(L_NOTICE, "Interface '%s' is now down\n", iface->name); mark_interface_down(iface); + interface_write_resolv_conf(iface->jail); if (iface->main_dev.dev) device_release(&iface->main_dev); if (iface->l3_dev.dev) device_remove_user(&iface->l3_dev); interface_handle_config_change(iface); - break; + return; case IFPEV_LINK_LOST: if (iface->state != IFS_UP) return; |