Date: Mon, 11 Apr 2016 17:23:47 +0000 (UTC) From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297825 - stable/10/sys/net Message-ID: <201604111723.u3BHNlYw029326@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: glebius Date: Mon Apr 11 17:23:47 2016 New Revision: 297825 URL: https://svnweb.freebsd.org/changeset/base/297825 Log: Merge r285713 (by zec@) from head: Prevent null-pointer dereferencing. Modified: stable/10/sys/net/if.c Modified: stable/10/sys/net/if.c ============================================================================== --- stable/10/sys/net/if.c Mon Apr 11 15:24:59 2016 (r297824) +++ stable/10/sys/net/if.c Mon Apr 11 17:23:47 2016 (r297825) @@ -339,11 +339,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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604111723.u3BHNlYw029326>