Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 Protect if_byindex with pserialize
details: https://anonhg.NetBSD.org/src/rev/ca96e3dbc508
branches: trunk
changeset: 346060:ca96e3dbc508
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Tue Jun 21 10:21:04 2016 +0000
description:
Protect if_byindex with pserialize
diffstat:
sys/netinet6/ip6_output.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diffs (43 lines):
diff -r f0b04a17649d -r ca96e3dbc508 sys/netinet6/ip6_output.c
--- a/sys/netinet6/ip6_output.c Tue Jun 21 10:18:27 2016 +0000
+++ b/sys/netinet6/ip6_output.c Tue Jun 21 10:21:04 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_output.c,v 1.168 2016/06/21 03:28:27 ozaki-r Exp $ */
+/* $NetBSD: ip6_output.c,v 1.169 2016/06/21 10:21:04 ozaki-r Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.168 2016/06/21 03:28:27 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.169 2016/06/21 10:21:04 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -2782,7 +2782,6 @@
#endif
case IPV6_PKTINFO:
{
- struct ifnet *ifp = NULL;
struct in6_pktinfo *pktinfo;
if (len != sizeof(struct in6_pktinfo))
@@ -2810,9 +2809,14 @@
/* Validate the interface index if specified. */
if (pktinfo->ipi6_ifindex) {
+ struct ifnet *ifp;
+ int s = pserialize_read_enter();
ifp = if_byindex(pktinfo->ipi6_ifindex);
- if (ifp == NULL)
- return (ENXIO);
+ if (ifp == NULL) {
+ pserialize_read_exit(s);
+ return ENXIO;
+ }
+ pserialize_read_exit(s);
}
/*
Home |
Main Index |
Thread Index |
Old Index