Module Name: src
Committed By: ozaki-r
Date: Mon Jun 26 08:01:53 UTC 2017
Modified Files:
src/sys/netinet6: ip6_output.c
Log Message:
Fix usage of ip6_get_membership
It may set nothing to ifp even if returning 0. So we need to NULL-clear
ifp before calling it.
Fix PR kern/52324
To generate a diff of this commit:
cvs rdiff -u -r1.191 -r1.192 src/sys/netinet6/ip6_output.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/netinet6/ip6_output.c
diff -u src/sys/netinet6/ip6_output.c:1.191 src/sys/netinet6/ip6_output.c:1.192
--- src/sys/netinet6/ip6_output.c:1.191 Fri Mar 3 07:13:06 2017
+++ src/sys/netinet6/ip6_output.c Mon Jun 26 08:01:53 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_output.c,v 1.191 2017/03/03 07:13:06 ozaki-r Exp $ */
+/* $NetBSD: ip6_output.c,v 1.192 2017/06/26 08:01:53 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.191 2017/03/03 07:13:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.192 2017/06/26 08:01:53 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -2561,8 +2561,10 @@ ip6_setmoptions(const struct sockopt *so
* Group must be a valid IP6 multicast address.
*/
bound = curlwp_bind();
+ ifp = NULL;
error = ip6_get_membership(sopt, &ifp, &psref, &ia, sizeof(ia));
if (error != 0) {
+ KASSERT(ifp == NULL);
curlwp_bindx(bound);
return error;
}