[sr-dev] git:3.2: dialog(k): proper unlock of profile for mi list command

Daniel-Constantin Mierla miconda at gmail.com
Mon Jun 25 18:40:17 CEST 2012


Module: sip-router
Branch: 3.2
Commit: 2a00c6d6439d9528c0445a8b1596a0c932623970
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2a00c6d6439d9528c0445a8b1596a0c932623970

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Jun 25 18:36:18 2012 +0200

dialog(k): proper unlock of profile for mi list command

- the profile was unlocked in a wrong place, before finishing listing
  the its content and could cause a race in accessing it
- reported by Ricardo Martinez
(cherry picked from commit 3a2e929c63c656fe2db78e746546af05c66740ea)

---

 modules_k/dialog/dlg_profile.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules_k/dialog/dlg_profile.c b/modules_k/dialog/dlg_profile.c
index b1e3078..52c7205 100644
--- a/modules_k/dialog/dlg_profile.c
+++ b/modules_k/dialog/dlg_profile.c
@@ -799,8 +799,8 @@ struct mi_root * mi_profile_list(struct mi_root *cmd_tree, void *param )
 					ph=ph->next;
 				}while( ph!=profile->entries[i].first );
 			}
-			lock_release( &profile->lock );
 		}
+		lock_release( &profile->lock );
 	} else {
 		/* check for value also */
 		lock_get( &profile->lock );
@@ -818,8 +818,8 @@ struct mi_root * mi_profile_list(struct mi_root *cmd_tree, void *param )
 					ph=ph->next;
 				}while( ph!=profile->entries[i].first );
 			}
-			lock_release( &profile->lock );
 		}
+		lock_release( &profile->lock );
 	}
 
 	return rpl_tree;




More information about the sr-dev mailing list