Showing error 957

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/dir.c
Line in file: 397
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2012-03-02 21:35:17 UTC


Source:

367{
368        struct inode *inode;
369
370        memset(acxt, 0, sizeof(*acxt));
371        acxt->parent_sd = parent_sd;
372
373        /* Lookup parent inode.  inode initialization is protected by
374         * sysfs_mutex, so inode existence can be determined by
375         * looking up inode while holding sysfs_mutex.
376         */
377        mutex_lock(&sysfs_mutex);
378
379        inode = ilookup5(sysfs_sb, parent_sd->s_ino, sysfs_ilookup_test,
380                         parent_sd);
381        if (inode) {
382                WARN_ON(inode->i_state & I_NEW);
383
384                /* parent inode available */
385                acxt->parent_inode = inode;
386
387                /* sysfs_mutex is below i_mutex in lock hierarchy.
388                 * First, trylock i_mutex.  If fails, unlock
389                 * sysfs_mutex and lock them in order.
390                 */
391                if (!mutex_trylock(&inode->i_mutex)) {
392                        mutex_unlock(&sysfs_mutex);
393                        mutex_lock(&inode->i_mutex);
394                        mutex_lock(&sysfs_mutex);
395                }
396        }
397}
398
399/**
400 *        __sysfs_add_one - add sysfs_dirent to parent without warning
401 *        @acxt: addrm context to use
402 *        @sd: sysfs_dirent to be added
403 *
404 *        Get @acxt->parent_sd and set sd->s_parent to it and increment
405 *        nlink of parent inode if @sd is a directory and link into the
406 *        children list of the parent.
407 *
Show full sources