diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2020-07-28 09:22:38 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2020-07-28 09:22:38 +0000 |
commit | 21f8bf273cb7514221245f5c6921a431ed96235f (patch) | |
tree | 6fff82208153a668ee3d1508879e683376d8ad9c /sys/netinet | |
parent | f6a261b811370f0d0d1d27b70e6150e049e7894a (diff) |
After the previous commit, src/regress/sys/netinet/carp triggered
an uvm fault. Check that ifp0 is not NULL.
OK sashan@ mvs@
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/ip_carp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 57e6fdf23e6..31796089b90 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_carp.c,v 1.347 2020/07/24 18:17:15 mvs Exp $ */ +/* $OpenBSD: ip_carp.c,v 1.348 2020/07/28 09:22:37 bluhm Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff. All rights reserved. @@ -1964,7 +1964,7 @@ carp_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) struct carpreq carpr; struct ifaddr *ifa = (struct ifaddr *)addr; struct ifreq *ifr = (struct ifreq *)addr; - struct ifnet *ifp0; + struct ifnet *ifp0 = NULL; int i, error = 0; switch (cmd) { @@ -2025,7 +2025,7 @@ carp_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) sc->sc_peer.s_addr = INADDR_CARP_GROUP; else sc->sc_peer.s_addr = carpr.carpr_peer.s_addr; - if (ifp0->if_index != sc->sc_carpdevidx) { + if (ifp0 != NULL && ifp0->if_index != sc->sc_carpdevidx) { if ((error = carp_set_ifp(sc, ifp0))) return (error); } |