Showing error 926

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/sysfs/bin.c
Line in file: 177
Project: Linux Kernel
Project version: 2.6.28
Confirmation: Fixed by e0edd3c65aa5b53e20280565a7ce11675eb7ed6b
Tools: Stanse (1.2)
Entered: 2012-03-02 21:35:17 UTC


Source:

147                goto out_free;
148        }
149
150        mutex_lock(&bb->mutex);
151
152        memcpy(bb->buffer, temp, count);
153
154        count = flush_write(dentry, bb->buffer, offs, count);
155        mutex_unlock(&bb->mutex);
156
157        if (count > 0)
158                *off = offs + count;
159
160out_free:
161        kfree(temp);
162        return count;
163}
164
165static int mmap(struct file *file, struct vm_area_struct *vma)
166{
167        struct bin_buffer *bb = file->private_data;
168        struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata;
169        struct bin_attribute *attr = attr_sd->s_bin_attr.bin_attr;
170        struct kobject *kobj = attr_sd->s_parent->s_dir.kobj;
171        int rc;
172
173        mutex_lock(&bb->mutex);
174
175        /* need attr_sd for attr, its parent for kobj */
176        if (!sysfs_get_active_two(attr_sd))
177                return -ENODEV;
178
179        rc = -EINVAL;
180        if (attr->mmap)
181                rc = attr->mmap(kobj, attr, vma);
182
183        if (rc == 0 && !bb->mmapped)
184                bb->mmapped = 1;
185        else
186                sysfs_put_active_two(attr_sd);
187
Show full sources