[PATCH] mISDN: correctly handling failed allocation in fsm

Subsystems: the rest

STALE3877d

2 messages, 2 authors, 2016-01-04 · open the first message on its own page

[PATCH] mISDN: correctly handling failed allocation in fsm

From: Insu Yun <hidden>
Date: 2015-12-29 21:38:48

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

Signed-off-by: Insu Yun <redacted>
---
 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

Re: [PATCH] mISDN: correctly handling failed allocation in fsm

From: David Miller <davem@davemloft.net>
Date: 2016-01-04 22:16:28

From: Insu Yun <redacted>
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 <redacted>
Similarly to your other mISDN patch you must propagate and handle
errors properly.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help