aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorInsu Yun <wuninsu@gmail.com>2015-12-29 17:20:11 -0500
committerDavid S. Miller <davem@davemloft.net>2016-01-04 17:18:42 -0500
commit3934aa4c1f7f4ccdff25f530b0e37d776ac453e2 (patch)
tree6089a510198e507a9b378683a9715e6c94e05fa9 /drivers
parentqlcnic: correctly handle qlcnic_alloc_mbx_args (diff)
downloadlinux-dev-3934aa4c1f7f4ccdff25f530b0e37d776ac453e2.tar.xz
linux-dev-3934aa4c1f7f4ccdff25f530b0e37d776ac453e2.zip
cxgb4: correctly handling failed allocation
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c b/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c
index c308429dd9c7..11dd91e4db56 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c
@@ -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++) {