diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-08-18 08:48:37 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-08-18 08:48:37 +0000 |
commit | 65e0c487d2c01a380418a7e665df48b74cc932e0 (patch) | |
tree | 555401acc1681c25d56436025a9770229ae72974 /sys | |
parent | 30e2bac16499ed22a3c0ae02be09dde4e00cccf4 (diff) |
Check the error value returned by in6_ifattach().
Prodded by and ok bluhm@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if.c | 10 | ||||
-rw-r--r-- | sys/netinet6/in6.c | 8 |
2 files changed, 12 insertions, 6 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 7677e33de45..f86ff78db91 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.359 2015/08/16 12:19:06 dlg Exp $ */ +/* $OpenBSD: if.c,v 1.360 2015/08/18 08:48:36 mpi Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -1314,11 +1314,11 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) case AF_INET6: s = splsoftnet(); if (cmd == SIOCIFAFATTACH) - in6_ifattach(ifp); + error = in6_ifattach(ifp); else in6_ifdetach(ifp); splx(s); - return (0); + return (error); #endif /* INET6 */ default: return (EAFNOSUPPORT); @@ -1382,8 +1382,10 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) #ifdef INET6 if (ISSET(ifr->ifr_flags, IFXF_AUTOCONF6)) { s = splsoftnet(); - in6_ifattach(ifp); + error = in6_ifattach(ifp); splx(s); + if (error != 0) + return (error); } if ((ifr->ifr_flags & IFXF_AUTOCONF6) && diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 91d2703e604..3e39d99e8a8 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.162 2015/08/12 09:06:18 mpi Exp $ */ +/* $OpenBSD: in6.c,v 1.163 2015/08/18 08:48:36 mpi Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -479,7 +479,11 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp) * is no link-local yet. */ s = splsoftnet(); - in6_ifattach(ifp); + error = in6_ifattach(ifp); + if (error != 0) { + splx(s); + return (error); + } error = in6_update_ifa(ifp, ifra, ia6); splx(s); if (error != 0) |