Ver Fonte

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
Daniel-Constantin Mierla há 13 anos atrás
pai
commit
3a2e929c63
1 ficheiros alterados com 2 adições e 2 exclusões
  1. 2 2
      modules_k/dialog/dlg_profile.c

+ 2 - 2
modules_k/dialog/dlg_profile.c

@@ -845,8 +845,8 @@ struct mi_root * mi_profile_list(struct mi_root *cmd_tree, void *param )
 					ph=ph->next;
 					ph=ph->next;
 				}while( ph!=profile->entries[i].first );
 				}while( ph!=profile->entries[i].first );
 			}
 			}
-			lock_release( &profile->lock );
 		}
 		}
+		lock_release( &profile->lock );
 	} else {
 	} else {
 		/* check for value also */
 		/* check for value also */
 		lock_get( &profile->lock );
 		lock_get( &profile->lock );
@@ -864,8 +864,8 @@ struct mi_root * mi_profile_list(struct mi_root *cmd_tree, void *param )
 					ph=ph->next;
 					ph=ph->next;
 				}while( ph!=profile->entries[i].first );
 				}while( ph!=profile->entries[i].first );
 			}
 			}
-			lock_release( &profile->lock );
 		}
 		}
+		lock_release( &profile->lock );
 	}
 	}
 
 
 	return rpl_tree;
 	return rpl_tree;