diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-05-15 11:58:12 +0300 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2012-05-15 10:39:28 -0500 |
commit | 75af271ed5f51b1f3506c7c1d567b1f32e5c9206 (patch) | |
tree | 5df97190f3ac4aba1bfed021e1a03392d447830e /fs/dlm | |
parent | 1a058f5288a74a20d5567a85ab1a04a9de69a212 (diff) | |
download | linux-75af271ed5f51b1f3506c7c1d567b1f32e5c9206.tar.bz2 |
dlm: NULL dereference on failure in kmem_cache_create()
We aren't allowed to pass NULL pointers to kmem_cache_destroy() so if
both allocations fail, it leads to a NULL dereference.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm')
-rw-r--r-- | fs/dlm/memory.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/dlm/memory.c b/fs/dlm/memory.c index da64df7576e1..7cd24bccd4fe 100644 --- a/fs/dlm/memory.c +++ b/fs/dlm/memory.c @@ -21,21 +21,19 @@ static struct kmem_cache *rsb_cache; int __init dlm_memory_init(void) { - int ret = 0; - lkb_cache = kmem_cache_create("dlm_lkb", sizeof(struct dlm_lkb), __alignof__(struct dlm_lkb), 0, NULL); if (!lkb_cache) - ret = -ENOMEM; + return -ENOMEM; rsb_cache = kmem_cache_create("dlm_rsb", sizeof(struct dlm_rsb), __alignof__(struct dlm_rsb), 0, NULL); if (!rsb_cache) { kmem_cache_destroy(lkb_cache); - ret = -ENOMEM; + return -ENOMEM; } - return ret; + return 0; } void dlm_memory_exit(void) |