git: bc73c7f61912 - stable/14 - ifnet: Remove unreachable code
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 04 May 2026 16:51:12 UTC
The branch stable/14 has been updated by zlei:
URL: https://cgit.FreeBSD.org/src/commit/?id=bc73c7f6191211b254f8cc87aab71d5ff853e24d
commit bc73c7f6191211b254f8cc87aab71d5ff853e24d
Author: Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2026-03-16 17:03:05 +0000
Commit: Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2026-05-04 16:49:40 +0000
ifnet: Remove unreachable code
The ioctls SIOCSIFVNET and SIOCSIFRVNET are for userland only. For
SIOCSIFVNET, if_vmove_loan(), the interface is obtained from current
VNET. For SIOCSIFRVNET, if_vmove_reclaim(), a valid child prison is
held before getting the interface. In both cases the VNET of the
obtained interfaces is stable, so there's no need to check it.
No functional change intended.
Reviewed by: glebius, jamie (for #jails)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D55828
(cherry picked from commit e0731059af912a27d0f842959218946b1daaa7d1)
(cherry picked from commit a989b0fbc965b453d97e3d032efb4f9c7592734a)
---
sys/net/if.c | 18 ------------------
1 file changed, 18 deletions(-)
diff --git a/sys/net/if.c b/sys/net/if.c
index 44f80a51eea8..2245863bda83 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1301,7 +1301,6 @@ if_vmove_loan(struct thread *td, struct ifnet *ifp, char *ifname, int jid)
struct prison *pr;
struct ifnet *difp;
bool found;
- bool shutdown;
MPASS(ifindex_table[ifp->if_index].ife_ifnet == ifp);
@@ -1331,14 +1330,6 @@ if_vmove_loan(struct thread *td, struct ifnet *ifp, char *ifname, int jid)
}
sx_xlock(&ifnet_detach_sxlock);
- /* Make sure the VNET is stable. */
- shutdown = VNET_IS_SHUTTING_DOWN(ifp->if_vnet);
- if (shutdown) {
- sx_xunlock(&ifnet_detach_sxlock);
- prison_free(pr);
- return (EBUSY);
- }
-
found = if_unlink_ifnet(ifp, true);
if (! found) {
sx_xunlock(&ifnet_detach_sxlock);
@@ -1365,7 +1356,6 @@ if_vmove_reclaim(struct thread *td, char *ifname, int jid)
struct vnet *vnet_dst;
struct ifnet *ifp;
int found __diagused;
- bool shutdown;
/* Try to find the prison within our visibility. */
sx_slock(&allprison_lock);
@@ -1393,14 +1383,6 @@ if_vmove_reclaim(struct thread *td, char *ifname, int jid)
return (EEXIST);
}
- /* Make sure the VNET is stable. */
- shutdown = VNET_IS_SHUTTING_DOWN(ifp->if_vnet);
- if (shutdown) {
- CURVNET_RESTORE();
- prison_free(pr);
- return (EBUSY);
- }
-
/* Get interface back from child jail/vnet. */
found = if_unlink_ifnet(ifp, true);
MPASS(found);