mISDN: correctly handling failed allocation
Subsystems (2)
PATCH 1/1 mISDN: correctly handling failed allocation
Since kzalloc can be failed in memory pressure,
NULL dereference might be happened.
Signed-off-by Insu Yun <[email protected]>
--- drivers/isdn/hardware/mISDN/hfcsusb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/isdn/hardware/mISDN/hfcsusb.c +3 -0
@@ -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;
Signature · 1 line
1.9.1
David Miller
maintainerFrom: Insu Yun <[email protected]>
Date: Tue, 29 Dec 2015 16:38:46 -0500
Quoted 4 lines
Since kzalloc can be failed in memory pressure,
NULL dereference might be happened.Signed-off-by Insu Yun <[email protected]>
Sorry, this is not a correct fix.
You need to propagate an error back to the callers, and they must act upon that error.