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

Since kzalloc can be failed in memory pressure,
NULL dereference can be happened.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
 drivers/isdn/mISDN/fsm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/isdn/mISDN/fsm.c b/drivers/isdn/mISDN/fsm.c
index 26477d4..3c3ffb0 100644
--- a/drivers/isdn/mISDN/fsm.c
+++ b/drivers/isdn/mISDN/fsm.c
@@ -34,6 +34,8 @@ mISDN_FsmNew(struct Fsm *fsm,
 
 	fsm->jumpmatrix = kzalloc(sizeof(FSMFNPTR) * fsm->state_count *
 				  fsm->event_count, GFP_KERNEL);
+	if (!fsm->jumpmatrix)
+		return;
 
 	for (i = 0; i < fncount; i++)
 		if ((fnlist[i].state >= fsm->state_count) ||
-- 
1.9.1


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

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

From: Insu Yun <wuninsu@gmail.com>
Date: Tue, 29 Dec 2015 16:41:33 -0500

> Since kzalloc can be failed in memory pressure,
> NULL dereference can be happened.
> 
> Signed-off-by: Insu Yun <wuninsu@gmail.com>

Similarly to your other mISDN patch you must propagate and handle
errors properly.

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-29 21:41 [PATCH] mISDN: correctly handling failed allocation in fsm Insu Yun
2016-01-04 22:16 ` 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).