Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Mar 2020 13:23:29 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r358542 - stable/12/sys/netinet6
Message-ID:  <202003021323.022DNT7j011365@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Mon Mar  2 13:23:28 2020
New Revision: 358542
URL: https://svnweb.freebsd.org/changeset/base/358542

Log:
  MFC r358427:  initialize oifp to avoid bogus results/panics in edge cases
  
    In certain cases (probably not during normal operation but observed in
    the lab during development) ip6_ouput() could return without error
    and ifpp (&oifp) not updated.
    Given oifp was never initialized we would take the later branch
    as oifp was not NULL, and when calling icmp6_ifstat_inc() we would
    panic dereferencing a garbage pointer.
    For code stability initialize oifp to NULL before first use to always
    have a deterministic value and not rely on a called function to behave
    and always and for ever do the work for us as we hope for.
  
    Sponsored by:	Netflix

Modified:
  stable/12/sys/netinet6/mld6.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet6/mld6.c
==============================================================================
--- stable/12/sys/netinet6/mld6.c	Mon Mar  2 13:16:40 2020	(r358541)
+++ stable/12/sys/netinet6/mld6.c	Mon Mar  2 13:23:28 2020	(r358542)
@@ -3155,6 +3155,7 @@ mld_dispatch_packet(struct mbuf *m)
 	mld = (struct mld_hdr *)(mtod(md, uint8_t *) + off);
 	type = mld->mld_type;
 
+	oifp = NULL;
 	error = ip6_output(m0, &mld_po, NULL, IPV6_UNSPECSRC, &im6o,
 	    &oifp, NULL);
 	if (error) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202003021323.022DNT7j011365>