Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet6 Fix usage of ip6_get_membership



details:   https://anonhg.NetBSD.org/src/rev/647ac6fa9125
branches:  trunk
changeset: 825010:647ac6fa9125
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Mon Jun 26 08:01:53 2017 +0000

description:
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

diffstat:

 sys/netinet6/ip6_output.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 88078f4b1f41 -r 647ac6fa9125 sys/netinet6/ip6_output.c
--- a/sys/netinet6/ip6_output.c Mon Jun 26 06:59:56 2017 +0000
+++ b/sys/netinet6/ip6_output.c Mon Jun 26 08:01:53 2017 +0000
@@ -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 @@
                 * 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;
                }



Home | Main Index | Thread Index | Old Index