Showing error 1882

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: net/core/sock.c
Line in file: 2100
Project: Linux Kernel
Project version: 2.6.28
Confirmation: Fixed by 72150e9b7fec217fbd646a29ea2f65a3d4d55ea9
Tools: Smatch (1.59)
Entered: 2013-09-11 08:47:26 UTC


Source:

2070                        prot->twsk_prot->twsk_slab_name = kmalloc(strlen(prot->name) + sizeof(mask) - 1, GFP_KERNEL);
2071
2072                        if (prot->twsk_prot->twsk_slab_name == NULL)
2073                                goto out_free_request_sock_slab;
2074
2075                        sprintf(prot->twsk_prot->twsk_slab_name, mask, prot->name);
2076                        prot->twsk_prot->twsk_slab =
2077                                kmem_cache_create(prot->twsk_prot->twsk_slab_name,
2078                                                  prot->twsk_prot->twsk_obj_size,
2079                                                  0, SLAB_HWCACHE_ALIGN,
2080                                                  NULL);
2081                        if (prot->twsk_prot->twsk_slab == NULL)
2082                                goto out_free_timewait_sock_slab_name;
2083                }
2084        }
2085
2086        write_lock(&proto_list_lock);
2087        list_add(&prot->node, &proto_list);
2088        assign_proto_idx(prot);
2089        write_unlock(&proto_list_lock);
2090        return 0;
2091
2092out_free_timewait_sock_slab_name:
2093        kfree(prot->twsk_prot->twsk_slab_name);
2094out_free_request_sock_slab:
2095        if (prot->rsk_prot && prot->rsk_prot->slab) {
2096                kmem_cache_destroy(prot->rsk_prot->slab);
2097                prot->rsk_prot->slab = NULL;
2098        }
2099out_free_request_sock_slab_name:
2100        kfree(prot->rsk_prot->slab_name);
2101out_free_sock_slab:
2102        kmem_cache_destroy(prot->slab);
2103        prot->slab = NULL;
2104out:
2105        return -ENOBUFS;
2106}
2107
2108EXPORT_SYMBOL(proto_register);
2109
2110void proto_unregister(struct proto *prot)
Show full sources