Author: zec Date: Mon Jul 20 08:21:51 2015 New Revision: 285713 URL: https://svnweb.freebsd.org/changeset/base/285713
Log: Prevent null-pointer dereferencing. MFC after: 3 days Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon Jul 20 07:26:31 2015 (r285712) +++ head/sys/net/if.c Mon Jul 20 08:21:51 2015 (r285713) @@ -335,11 +335,12 @@ ifnet_setbyindex(u_short idx, struct ifn struct ifaddr * ifaddr_byindex(u_short idx) { - struct ifaddr *ifa; + struct ifnet *ifp; + struct ifaddr *ifa = NULL; IFNET_RLOCK_NOSLEEP(); - ifa = ifnet_byindex_locked(idx)->if_addr; - if (ifa != NULL) + ifp = ifnet_byindex_locked(idx); + if (ifp != NULL && (ifa = ifp->if_addr) != NULL) ifa_ref(ifa); IFNET_RUNLOCK_NOSLEEP(); return (ifa); _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"