svn commit: r297825 - stable/10/sys/net
Gleb Smirnoff
glebius at FreeBSD.org
Mon Apr 11 17:23:48 UTC 2016
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);
More information about the svn-src-all
mailing list