svn commit: r367594 - head/sys/net

Andrey V. Elsukov ae at FreeBSD.org
Wed Nov 11 15:53:37 UTC 2020


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 */


More information about the svn-src-all mailing list