Author: gnn
Date: Thu Jan 16 22:14:54 2014
New Revision: 260796
URL: http://svnweb.freebsd.org/changeset/base/260796

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

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==============================================================================
--- head/sys/netinet/in_mcast.c Thu Jan 16 21:56:05 2014        (r260795)
+++ head/sys/netinet/in_mcast.c Thu Jan 16 22:14:54 2014        (r260796)
@@ -1496,7 +1496,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__);
@@ -1504,6 +1504,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:
@@ -2172,8 +2174,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__);
@@ -2181,20 +2187,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);
@@ -2398,7 +2405,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__);
@@ -2409,9 +2416,10 @@ inp_leave_group(struct inpcb *inp, struc
                }
        }
 
+out_in_multi_locked:
+
        IN_MULTI_UNLOCK();
 
-out_imf_rollback:
        if (error)
                imf_rollback(imf);
        else
@@ -2645,7 +2653,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__);
@@ -2653,6 +2661,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:
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to