diff options
author | Insu Yun <wuninsu@gmail.com> | 2015-12-29 22:20:11 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-01-04 22:18:42 (GMT) |
commit | 3934aa4c1f7f4ccdff25f530b0e37d776ac453e2 (patch) | |
tree | 6089a510198e507a9b378683a9715e6c94e05fa9 /drivers/net/ethernet/chelsio | |
parent | b77357b69225a8e68d222451911feab50f2c6652 (diff) | |
download | linux-3934aa4c1f7f4ccdff25f530b0e37d776ac453e2.tar.xz |
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/net/ethernet/chelsio')
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c | 4 |
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 c308429..11dd91e 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++) { |