diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-11-22 12:11:39 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-11-22 12:11:39 +0000 |
commit | 8314bfaf4cc9e01b152b3aeebd4f9093ea73b731 (patch) | |
tree | 1401f83b94e2977038a4fbee7ca8f2c74af80b3d /sys/nfs/nfs_boot.c | |
parent | 0c891e89267cbeabdff8ebf8ed0629f4fb875835 (diff) |
Enforce that ifioctl() is called at IPL_SOFTNET.
This will allow us to keep locking simple as soon as we trade
splsoftnet() for a rwlock.
ok bluhm@
Diffstat (limited to 'sys/nfs/nfs_boot.c')
-rw-r--r-- | sys/nfs/nfs_boot.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/nfs/nfs_boot.c b/sys/nfs/nfs_boot.c index fe50ad05c6e..6233bf262aa 100644 --- a/sys/nfs/nfs_boot.c +++ b/sys/nfs/nfs_boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_boot.c,v 1.39 2015/09/01 21:24:04 bluhm Exp $ */ +/* $OpenBSD: nfs_boot.c,v 1.40 2016/11/22 12:11:38 mpi Exp $ */ /* $NetBSD: nfs_boot.c,v 1.26 1996/05/07 02:51:25 thorpej Exp $ */ /* @@ -122,7 +122,7 @@ nfs_boot_init(struct nfs_diskless *nd, struct proc *procp) struct socket *so; struct ifaddr *ifa; char addr[INET_ADDRSTRLEN]; - int error; + int s, error; /* * Find an interface, rarp for its ip address, stuff it, the @@ -159,11 +159,15 @@ nfs_boot_init(struct nfs_diskless *nd, struct proc *procp) */ if ((error = socreate(AF_INET, &so, SOCK_DGRAM, 0)) != 0) panic("nfs_boot: socreate, error=%d", error); + s = splsoftnet(); error = ifioctl(so, SIOCGIFFLAGS, (caddr_t)&ireq, procp); + splx(s); if (error) panic("nfs_boot: GIFFLAGS, error=%d", error); ireq.ifr_flags |= IFF_UP; + s = splsoftnet(); error = ifioctl(so, SIOCSIFFLAGS, (caddr_t)&ireq, procp); + splx(s); if (error) panic("nfs_boot: SIFFLAGS, error=%d", error); @@ -186,7 +190,9 @@ nfs_boot_init(struct nfs_diskless *nd, struct proc *procp) sin->sin_len = sizeof(*sin); sin->sin_family = AF_INET; sin->sin_addr.s_addr = my_ip.s_addr; + s = splsoftnet(); error = ifioctl(so, SIOCAIFADDR, (caddr_t)&ifra, procp); + splx(s); if (error) panic("nfs_boot: set if addr, error=%d", error); |