From 634744860174d0336dc8207648750d3c6d600d7a Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Thu, 7 Nov 2019 11:23:25 +0000 Subject: Avoid NULL dereference in arpinvalidate() and nd6_invalidate() by making RTM_INVALIDATE code path perform same check as RTM_DELETE does. ok mpi@ --- sys/netinet/if_ether.c | 4 +++- sys/netinet6/nd6.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index e23c94ab4c1..f950dbebc33 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.241 2019/10/16 10:22:01 mpi Exp $ */ +/* $OpenBSD: if_ether.c,v 1.242 2019/11/07 11:23:23 krw Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -207,6 +207,8 @@ arp_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt) break; case RTM_INVALIDATE: + if (la == NULL) + break; if (!ISSET(rt->rt_flags, RTF_LOCAL)) arpinvalidate(rt); break; diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 5ca7c428daf..db2fda85e74 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.227 2019/06/13 08:15:26 claudio Exp $ */ +/* $OpenBSD: nd6.c,v 1.228 2019/11/07 11:23:24 krw Exp $ */ /* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */ /* @@ -1004,6 +1004,8 @@ nd6_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt) break; case RTM_INVALIDATE: + if (ln == NULL) + break; if (!ISSET(rt->rt_flags, RTF_LOCAL)) nd6_invalidate(rt); break; -- cgit v1.2.3