]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
cxgb4: correctly handling failed allocation
authorInsu Yun <wuninsu@gmail.com>
Tue, 29 Dec 2015 22:20:11 +0000 (17:20 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 Jan 2016 22:18:42 +0000 (17:18 -0500)
Since t4_alloc_mem can be failed in memory pressure,
if not properly handled, NULL dereference could be happened.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c

index c308429dd9c7fa0aebf2cee3b951f71f3863d939..11dd91e4db56b061311645567ab8c46f80123a61 100644 (file)
@@ -295,6 +295,10 @@ struct clip_tbl *t4_init_clip_tbl(unsigned int clipt_start,
                INIT_LIST_HEAD(&ctbl->hash_list[i]);
 
        cl_list = t4_alloc_mem(clipt_size*sizeof(struct clip_entry));
+       if (!cl_list) {
+               t4_free_mem(ctbl);
+               return NULL;
+       }
        ctbl->cl_list = (void *)cl_list;
 
        for (i = 0; i < clipt_size; i++) {