Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Nov 2020 15:53:36 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r367594 - head/sys/net
Message-ID:  <202011111553.0ABFraMd024938@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Wed Nov 11 15:53:36 2020
New Revision: 367594
URL: https://svnweb.freebsd.org/changeset/base/367594

Log:
  Fix possible NULL pointer dereference.
  
  lagg(4) replaces if_output method of its child interfaces and expects
  that this method can be called only by child interfaces. But it is
  possible that lagg_port_output() could be called by children of child
  interfaces. In this case ifnet's if_lagg field is NULL. Add check that
  lp is not NULL.
  
  Obtained from:	Yandex LLC
  MFC after:	1 week
  Sponsored by:	Yandex LLC

Modified:
  head/sys/net/if_lagg.c

Modified: head/sys/net/if_lagg.c
==============================================================================
--- head/sys/net/if_lagg.c	Wed Nov 11 15:01:17 2020	(r367593)
+++ head/sys/net/if_lagg.c	Wed Nov 11 15:53:36 2020	(r367594)
@@ -1145,7 +1145,8 @@ lagg_port_output(struct ifnet *ifp, struct mbuf *m,
 	switch (dst->sa_family) {
 		case pseudo_AF_HDRCMPLT:
 		case AF_UNSPEC:
-			return ((*lp->lp_output)(ifp, m, dst, ro));
+			if (lp != NULL)
+				return ((*lp->lp_output)(ifp, m, dst, ro));
 	}
 
 	/* drop any other frames */



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