No unlock except for the NULL case, but this lets us clean up the callers
a little.
OK?
Index: netinet6/ip6_mroute.c
===================================================================
RCS file: /cvs/src/sys/netinet6/ip6_mroute.c,v
retrieving revision 1.135
diff -u -p -r1.135 ip6_mroute.c
--- netinet6/ip6_mroute.c 8 Sep 2022 10:22:07 -0000 1.135
+++ netinet6/ip6_mroute.c 19 Apr 2023 17:51:34 -0000
@@ -245,6 +245,8 @@ mrt6_ioctl(struct socket *so, u_long cmd
if (inp == NULL)
return (ENOTCONN);
+ KERNEL_LOCK();
+
switch (cmd) {
case SIOCGETSGCNT_IN6:
NET_LOCK_SHARED();
@@ -262,6 +264,8 @@ mrt6_ioctl(struct socket *so, u_long cmd
error = ENOTTY;
break;
}
+
+ KERNEL_UNLOCK();
return error;
}
Index: netinet6/in6.c
===================================================================
RCS file: /cvs/src/sys/netinet6/in6.c,v
retrieving revision 1.259
diff -u -p -r1.259 in6.c
--- netinet6/in6.c 6 Dec 2022 22:19:39 -0000 1.259
+++ netinet6/in6.c 19 Apr 2023 17:52:35 -0000
@@ -207,9 +206,7 @@ in6_control(struct socket *so, u_long cm
#ifdef MROUTING
case SIOCGETSGCNT_IN6:
case SIOCGETMIFCNT_IN6:
- KERNEL_LOCK();
error = mrt6_ioctl(so, cmd, data);
- KERNEL_UNLOCK();
break;
#endif /* MROUTING */
default:
Index: netinet/ip_mroute.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_mroute.c,v
retrieving revision 1.137
diff -u -p -r1.137 ip_mroute.c
--- netinet/ip_mroute.c 8 Sep 2022 10:22:06 -0000 1.137
+++ netinet/ip_mroute.c 19 Apr 2023 17:50:37 -0000
@@ -261,6 +261,8 @@ mrt_ioctl(struct socket *so, u_long cmd,
if (inp == NULL)
return (ENOTCONN);
+ KERNEL_LOCK();
+
if (so != ip_mrouter[inp->inp_rtableid])
error = EINVAL;
else
@@ -282,6 +284,7 @@ mrt_ioctl(struct socket *so, u_long cmd,
break;
}
+ KERNEL_UNLOCK();
return (error);
}
Index: netinet/in.c
===================================================================
RCS file: /cvs/src/sys/netinet/in.c,v
retrieving revision 1.181
diff -u -p -r1.181 in.c
--- netinet/in.c 18 Apr 2023 22:20:16 -0000 1.181
+++ netinet/in.c 19 Apr 2023 17:52:59 -0000
@@ -210,9 +209,7 @@ in_control(struct socket *so, u_long cmd
#ifdef MROUTING
case SIOCGETVIFCNT:
case SIOCGETSGCNT:
- KERNEL_LOCK();
error = mrt_ioctl(so, cmd, data);
- KERNEL_UNLOCK();
break;
#endif /* MROUTING */
default: