浏览代码

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)
Daniel-Constantin Mierla 13 年之前
父节点
当前提交
2a00c6d643
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      modules_k/dialog/dlg_profile.c

+ 2 - 2
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;