pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31081 )
Change subject: tun: Fix potential unpaired call to osmo_netns_switch_exit() ......................................................................
tun: Fix potential unpaired call to osmo_netns_switch_exit()
Fixes: Coverity CID#307429 Change-Id: Iadfc9eb48c6342433eee8da3e4d00ee496df3c75 --- M src/core/tun.c 1 file changed, 2 insertions(+), 1 deletion(-)
Approvals: pespin: Looks good to me, approved osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/src/core/tun.c b/src/core/tun.c index 7f61183..4c9dec1 100644 --- a/src/core/tun.c +++ b/src/core/tun.c @@ -407,7 +407,8 @@ close(tundev->wqueue.bfd.fd); tundev->wqueue.bfd.fd = -1; err_restore_ns: - osmo_netns_switch_exit(&switch_state); + if (tundev->netns_name) + osmo_netns_switch_exit(&switch_state); err_close_netns_fd: if (netns_fd >= 0) close(netns_fd);