Author: gnn
Date: Sun Feb  9 21:48:14 2014
New Revision: 261694
URL: http://svnweb.freebsd.org/changeset/base/261694

Log:
  MFC: 260796
  
  Fix various places where we don't properly release a lock.
  
  PR:           185043
  Submitted by: Michael Bentkofsky

Modified:
  stable/9/sys/netinet/in_mcast.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet/in_mcast.c
==============================================================================
--- stable/9/sys/netinet/in_mcast.c     Sun Feb  9 21:47:46 2014        
(r261693)
+++ stable/9/sys/netinet/in_mcast.c     Sun Feb  9 21:48:14 2014        
(r261694)
@@ -1446,7 +1446,7 @@ inp_block_unblock_source(struct inpcb *i
        error = inm_merge(inm, imf);
        if (error) {
                CTR1(KTR_IGMPV3, "%s: failed to merge inm state", __func__);
-               goto out_imf_rollback;
+               goto out_in_multi_locked;
        }
 
        CTR1(KTR_IGMPV3, "%s: doing igmp downcall", __func__);
@@ -1454,6 +1454,8 @@ inp_block_unblock_source(struct inpcb *i
        if (error)
                CTR1(KTR_IGMPV3, "%s: failed igmp downcall", __func__);
 
+out_in_multi_locked:
+
        IN_MULTI_UNLOCK();
 
 out_imf_rollback:
@@ -2094,8 +2096,12 @@ inp_join_group(struct inpcb *inp, struct
        if (is_new) {
                error = in_joingroup_locked(ifp, &gsa->sin.sin_addr, imf,
                    &inm);
-               if (error)
+               if (error) {
+                        CTR1(KTR_IGMPV3, "%s: in_joingroup_locked failed", 
+                            __func__);
+                        IN_MULTI_UNLOCK();
                        goto out_imo_free;
+                }
                imo->imo_membership[idx] = inm;
        } else {
                CTR1(KTR_IGMPV3, "%s: merge inm state", __func__);
@@ -2103,20 +2109,21 @@ inp_join_group(struct inpcb *inp, struct
                if (error) {
                        CTR1(KTR_IGMPV3, "%s: failed to merge inm state",
                            __func__);
-                       goto out_imf_rollback;
+                       goto out_in_multi_locked;
                }
                CTR1(KTR_IGMPV3, "%s: doing igmp downcall", __func__);
                error = igmp_change_state(inm);
                if (error) {
                        CTR1(KTR_IGMPV3, "%s: failed igmp downcall",
                            __func__);
-                       goto out_imf_rollback;
+                       goto out_in_multi_locked;
                }
        }
 
+out_in_multi_locked:
+
        IN_MULTI_UNLOCK();
 
-out_imf_rollback:
        INP_WLOCK_ASSERT(inp);
        if (error) {
                imf_rollback(imf);
@@ -2320,7 +2327,7 @@ inp_leave_group(struct inpcb *inp, struc
                if (error) {
                        CTR1(KTR_IGMPV3, "%s: failed to merge inm state",
                            __func__);
-                       goto out_imf_rollback;
+                       goto out_in_multi_locked;
                }
 
                CTR1(KTR_IGMPV3, "%s: doing igmp downcall", __func__);
@@ -2331,9 +2338,10 @@ inp_leave_group(struct inpcb *inp, struc
                }
        }
 
+out_in_multi_locked:
+
        IN_MULTI_UNLOCK();
 
-out_imf_rollback:
        if (error)
                imf_rollback(imf);
        else
@@ -2567,7 +2575,7 @@ inp_set_source_filters(struct inpcb *inp
        error = inm_merge(inm, imf);
        if (error) {
                CTR1(KTR_IGMPV3, "%s: failed to merge inm state", __func__);
-               goto out_imf_rollback;
+               goto out_in_multi_locked;
        }
 
        CTR1(KTR_IGMPV3, "%s: doing igmp downcall", __func__);
@@ -2575,6 +2583,8 @@ inp_set_source_filters(struct inpcb *inp
        if (error)
                CTR1(KTR_IGMPV3, "%s: failed igmp downcall", __func__);
 
+out_in_multi_locked:
+
        IN_MULTI_UNLOCK();
 
 out_imf_rollback:
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to