User: | Jiri Slaby |
Error type: | Leaving function in locked state |
Error type description: | Some lock is not unlocked on all paths of a function, so it is leaked |
File location: | fs/configfs/dir.c |
Line in file: | 977 |
Project: | Linux Kernel |
Project version: | 2.6.28 |
Tools: |
Stanse
(1.2)
|
Entered: | 2012-03-02 21:35:17 UTC |
947 * much on the stack, though, so folks that need this function - be careful 948 * about your stack! Patches will be accepted to make it iterative. 949 */ 950static int configfs_depend_prep(struct dentry *origin, 951 struct config_item *target) 952{ 953 struct configfs_dirent *child_sd, *sd = origin->d_fsdata; 954 int ret = 0; 955 956 BUG_ON(!origin || !sd); 957 958 /* Lock this guy on the way down */ 959 mutex_lock(&sd->s_dentry->d_inode->i_mutex); 960 if (sd->s_element == target) /* Boo-yah */ 961 goto out; 962 963 list_for_each_entry(child_sd, &sd->s_children, s_sibling) { 964 if (child_sd->s_type & CONFIGFS_DIR) { 965 ret = configfs_depend_prep(child_sd->s_dentry, 966 target); 967 if (!ret) 968 goto out; /* Child path boo-yah */ 969 } 970 } 971 972 /* We looped all our children and didn't find target */ 973 mutex_unlock(&sd->s_dentry->d_inode->i_mutex); 974 ret = -ENOENT; 975 976out: 977 return ret; 978} 979 980/* 981 * This is ONLY called if configfs_depend_prep() did its job. So we can 982 * trust the entire path from item back up to origin. 983 * 984 * We walk backwards from item, unlocking each i_mutex. We finish by 985 * unlocking origin. 986 */ 987static void configfs_depend_rollback(struct dentry *origin,