netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mISDN: correctly handling failed allocation
@ 2015-12-29 21:38 Insu Yun
  2016-01-04 22:16 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Insu Yun @ 2015-12-29 21:38 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 might be happened.

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

diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c
index 114f3bc..15164e9 100644
--- a/drivers/isdn/hardware/mISDN/hfcsusb.c
+++ b/drivers/isdn/hardware/mISDN/hfcsusb.c
@@ -264,6 +264,9 @@ hfcsusb_ph_info(struct hfcsusb *hw)
 
 	phi = kzalloc(sizeof(struct ph_info) +
 		      dch->dev.nrbchan * sizeof(struct ph_info_ch), GFP_ATOMIC);
+	if (!phi)
+		return;
+
 	phi->dch.ch.protocol = hw->protocol;
 	phi->dch.ch.Flags = dch->Flags;
 	phi->dch.state = dch->state;
-- 
1.9.1

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

* Re: [PATCH] mISDN: correctly handling failed allocation
  2015-12-29 21:38 [PATCH] mISDN: correctly handling failed allocation 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:38:46 -0500

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

Sorry, this is not a correct fix.

You need to propagate an error back to the callers, and
they must act upon that error.

^ 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:38 [PATCH] mISDN: correctly handling failed allocation 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).