Showing error 1090

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: ipc/sem.c
Line in file: 270
Project: Linux Kernel
Project version: 2.6.28
Tools: Undetermined 1
Entered: 2012-03-04 17:07:06 UTC


Source:

 240        key_t key = params->key;
 241        int nsems = params->u.nsems;
 242        int semflg = params->flg;
 243
 244        if (!nsems)
 245                return -EINVAL;
 246        if (ns->used_sems + nsems > ns->sc_semmns)
 247                return -ENOSPC;
 248
 249        size = sizeof (*sma) + nsems * sizeof (struct sem);
 250        sma = ipc_rcu_alloc(size);
 251        if (!sma) {
 252                return -ENOMEM;
 253        }
 254        memset (sma, 0, size);
 255
 256        sma->sem_perm.mode = (semflg & S_IRWXUGO);
 257        sma->sem_perm.key = key;
 258
 259        sma->sem_perm.security = NULL;
 260        retval = security_sem_alloc(sma);
 261        if (retval) {
 262                ipc_rcu_putref(sma);
 263                return retval;
 264        }
 265
 266        id = ipc_addid(&sem_ids(ns), &sma->sem_perm, ns->sc_semmni);
 267        if (id < 0) {
 268                security_sem_free(sma);
 269                ipc_rcu_putref(sma);
 270                return id;
 271        }
 272        ns->used_sems += nsems;
 273
 274        sma->sem_base = (struct sem *) &sma[1];
 275        INIT_LIST_HEAD(&sma->sem_pending);
 276        INIT_LIST_HEAD(&sma->list_id);
 277        sma->sem_nsems = nsems;
 278        sma->sem_ctime = get_seconds();
 279        sem_unlock(sma);
 280
Show full sources