Author: markj
Date: Thu Apr  2 15:30:51 2020
New Revision: 359565
URL: https://svnweb.freebsd.org/changeset/base/359565

Log:
  MFC r359154:
  Fix synchronization in the IPV6_2292PKTOPTIONS set handler.

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

Modified: stable/12/sys/netinet6/ip6_output.c
==============================================================================
--- stable/12/sys/netinet6/ip6_output.c Thu Apr  2 15:30:30 2020        
(r359564)
+++ stable/12/sys/netinet6/ip6_output.c Thu Apr  2 15:30:51 2020        
(r359565)
@@ -1549,8 +1549,10 @@ ip6_ctloutput(struct socket *so, struct sockopt *sopt)
                                error = soopt_mcopyin(sopt, m); /* XXX */
                                if (error != 0)
                                        break;
-                               error = ip6_pcbopts(&inp->in6p_outputopts,
-                                                   m, so, sopt);
+                               INP_WLOCK(inp);
+                               error = ip6_pcbopts(&inp->in6p_outputopts, m,
+                                   so, sopt);
+                               INP_WUNLOCK(inp);
                                m_freem(m); /* XXX */
                                break;
                        }
@@ -2310,8 +2312,11 @@ ip6_pcbopts(struct ip6_pktopts **pktopt, struct mbuf *
                        printf("ip6_pcbopts: all specified options are 
cleared.\n");
 #endif
                ip6_clearpktopts(opt, -1);
-       } else
-               opt = malloc(sizeof(*opt), M_IP6OPT, M_WAITOK);
+       } else {
+               opt = malloc(sizeof(*opt), M_IP6OPT, M_NOWAIT);
+               if (opt == NULL)
+                       return (ENOMEM);
+       }
        *pktopt = NULL;
 
        if (!m || m->m_len == 0) {
_______________________________________________
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