Author: ae
Date: Wed Nov 18 13:52:13 2020
New Revision: 367790
URL: https://svnweb.freebsd.org/changeset/base/367790

Log:
  MFC r367594:
    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.

Modified:
  stable/12/sys/net/if_lagg.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net/if_lagg.c
==============================================================================
--- stable/12/sys/net/if_lagg.c Wed Nov 18 13:47:11 2020        (r367789)
+++ stable/12/sys/net/if_lagg.c Wed Nov 18 13:52:13 2020        (r367790)
@@ -1033,7 +1033,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 */
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to