-/* $OpenBSD: kern_sysctl.c,v 1.438 2024/08/14 13:54:08 mvs Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.439 2024/08/14 17:52:47 mvs Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
fn = uvm_sysctl;
break;
case CTL_NET:
+ dolock = 0;
fn = net_sysctl;
break;
case CTL_FS:
-/* $OpenBSD: uipc_domain.c,v 1.66 2024/08/12 11:25:27 bluhm Exp $ */
+/* $OpenBSD: uipc_domain.c,v 1.67 2024/08/14 17:52:47 mvs Exp $ */
/* $NetBSD: uipc_domain.c,v 1.14 1996/02/09 19:00:44 christos Exp $ */
/*
return (EISDIR); /* overloaded */
protocol = name[1];
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
- if (pr->pr_protocol == protocol && pr->pr_sysctl)
- return ((*pr->pr_sysctl)(name + 2, namelen - 2,
- oldp, oldlenp, newp, newlen));
+ if (pr->pr_protocol == protocol && pr->pr_sysctl) {
+ size_t savelen = *oldlenp;
+ int error;
+
+ if ((error = sysctl_vslock(oldp, savelen)))
+ return (error);
+ error = (*pr->pr_sysctl)(name + 2, namelen - 2,
+ oldp, oldlenp, newp, newlen);
+ sysctl_vsunlock(oldp, savelen);
+
+ return (error);
+ }
return (ENOPROTOOPT);
}
-/* $OpenBSD: mpls_raw.c,v 1.20 2024/04/29 00:29:48 jsg Exp $ */
+/* $OpenBSD: mpls_raw.c,v 1.21 2024/08/14 17:52:47 mvs Exp $ */
/*
* Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project.
mpls_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen)
{
- return sysctl_bounded_arr(mplsctl_vars, nitems(mplsctl_vars),
+ int error;
+
+ KERNEL_LOCK();
+ error = sysctl_bounded_arr(mplsctl_vars, nitems(mplsctl_vars),
name, namelen, oldp, oldlenp, newp, newlen);
+ KERNEL_UNLOCK();
+
+ return error;
}