Author: shurd
Date: Fri May 11 21:42:27 2018
New Revision: 333505
URL: https://svnweb.freebsd.org/changeset/base/333505

Log:
  Fix LORs in in6?_leave_group()
  
  r333175 updated the join_group functions, but not the leave_group ones.
  
  Reviewed by:  sbruno
  Sponsored by: Limelight Networks
  Differential Revision:        https://reviews.freebsd.org/D15393

Modified:
  head/sys/netinet/in_mcast.c
  head/sys/netinet6/in6_mcast.c

Modified: head/sys/netinet/in_mcast.c
==============================================================================
--- head/sys/netinet/in_mcast.c Fri May 11 20:47:45 2018        (r333504)
+++ head/sys/netinet/in_mcast.c Fri May 11 21:42:27 2018        (r333505)
@@ -2501,6 +2501,8 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sop
        /*
         * Begin state merge transaction at IGMP layer.
         */
+       in_pcbref(inp);
+       INP_WUNLOCK(inp);
        IN_MULTI_LOCK();
 
        if (is_final) {
@@ -2531,6 +2533,9 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sop
 out_in_multi_locked:
 
        IN_MULTI_UNLOCK();
+       INP_WLOCK(inp);
+       if (in_pcbrele_wlocked(inp))
+               return (ENXIO);
 
        if (error)
                imf_rollback(imf);

Modified: head/sys/netinet6/in6_mcast.c
==============================================================================
--- head/sys/netinet6/in6_mcast.c       Fri May 11 20:47:45 2018        
(r333504)
+++ head/sys/netinet6/in6_mcast.c       Fri May 11 21:42:27 2018        
(r333505)
@@ -2381,6 +2381,8 @@ in6p_leave_group(struct inpcb *inp, struct sockopt *so
        /*
         * Begin state merge transaction at MLD layer.
         */
+       in_pcbref(inp);
+       INP_WUNLOCK(inp);
        IN6_MULTI_LOCK();
 
        if (is_final) {
@@ -2407,6 +2409,9 @@ in6p_leave_group(struct inpcb *inp, struct sockopt *so
        }
 
        IN6_MULTI_UNLOCK();
+       INP_WLOCK(inp);
+       if (in_pcbrele_wlocked(inp))
+               return (ENXIO);
 
        if (error)
                im6f_rollback(imf);
_______________________________________________
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