Skip to contentSkip to conversation

security/integrity/ima/ima_iint.c: Remove goto out int ima_inode_alloc()

PATCH In review wzt wzt 2 participants 2 messages Feb 8, 2010

Subsystems (3)
lore
Share & tools
lore

wzt wzt

author
#0 lore raw

PATCH 1/1 security/integrity/ima/ima_iint.c: Remove goto out int ima_inode_alloc()

(quoted diff) +0 -0

b/security/integrity/ima/ima_iint.c
index 0d83edc..4e2df22 100644

security/integrity/ima/ima_iint.c +5 -6
@@ -57,18 +57,17 @@ int ima_inode_alloc(struct inode *inode)
                return -ENOMEM;
 
        rc = radix_tree_preload(GFP_NOFS);
-       if (rc < 0)
-               goto out;
+       if (rc < 0) {
+               kmem_cache_free(iint_cache, iint);
+               radix_tree_preload_end();
+               return rc;
+       }
 
        spin_lock(&ima_iint_lock);
        rc = radix_tree_insert(&ima_iint_store, (unsigned long)inode, iint);
        spin_unlock(&ima_iint_lock);
-out:
-       if (rc < 0)
-               kmem_cache_free(iint_cache, iint);
 
        radix_tree_preload_end();
-
        return rc;
 }
#1 lore raw
Quoted 15 lines · wzt wzt
security/integrity/ima/ima_iint.c +2 -2
index 0d83edc..4e2df22 100644
@@ -57,18 +57,17 @@ int ima_inode_alloc(struct inode *inode)
                return -ENOMEM;
 
        rc = radix_tree_preload(GFP_NOFS);
-       if (rc < 0)
-               goto out;
+       if (rc < 0) {
+               kmem_cache_free(iint_cache, iint);

security/integrity/ima/ima_iint.c int ima_inode_alloc(struct inode *inode) · line 68

Quoted 10 lines
security/integrity/ima/ima_iint.c +3 -3
+               radix_tree_preload_end();
+               return rc;
+       }
 
        spin_lock(&ima_iint_lock);
        rc = radix_tree_insert(&ima_iint_store, (unsigned long)inode, iint);
        spin_unlock(&ima_iint_lock);
-out:
-       if (rc < 0)
-               kmem_cache_free(iint_cache, iint);

So if radix_tree_insert failed, the memory will be leaked. This patch doesn't fix anything but introduces new bug....

Quoted 11 lines
security/integrity/ima/ima_iint.c +0 -2
        radix_tree_preload_end();
-
        return rc;
  }
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/