netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cxgb4: correctly handling failed allocation
@ 2015-12-29 22:20 Insu Yun
  2016-01-04 22:19 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Insu Yun @ 2015-12-29 22:20 UTC (permalink / raw)
  To: hariprasad, netdev, linux-kernel
  Cc: taesoo, yeongjin.jang, insu, changwoo, Insu Yun

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>
---
 drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c | 4 ++++
 1 file changed, 4 insertions(+)

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++) {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cxgb4: correctly handling failed allocation
  2015-12-29 22:20 [PATCH] cxgb4: correctly handling failed allocation Insu Yun
@ 2016-01-04 22:19 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-01-04 22:19 UTC (permalink / raw)
  To: wuninsu
  Cc: hariprasad, netdev, linux-kernel, taesoo, yeongjin.jang, insu, changwoo

From: Insu Yun <wuninsu@gmail.com>
Date: Tue, 29 Dec 2015 17:20:11 -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>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-04 22:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-29 22:20 [PATCH] cxgb4: correctly handling failed allocation Insu Yun
2016-01-04 22:19 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).