Skip to contentSkip to conversation

mISDN: correctly handling failed allocation in fsm

PATCH In review Insu Yun 2 participants 2 messages Dec 29, 2015 – Jan 4, 2016

Subsystems (2)
lore
Share & tools
lore

Insu Yun

author
#0 lore raw

PATCH 1/1 mISDN: correctly handling failed allocation in fsm

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

---
 drivers/isdn/mISDN/fsm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/isdn/mISDN/fsm.c +2 -0
index 26477d4..3c3ffb0 100644
@@ -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) ||
Signature · 1 line
1.9.1
maintainer
#1 lore raw

From: Insu Yun <[email protected]>
Date: Tue, 29 Dec 2015 16:41:33 -0500

Quoted 4 lines

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

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