From: Aditya Pakki Date: Sat, 2 Mar 2019 21:20:43 +0000 (-0600) Subject: isdn: mISDN: Fix potential NULL pointer dereference of kzalloc X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=38d22659803a;p=linux.git isdn: mISDN: Fix potential NULL pointer dereference of kzalloc Allocating memory via kzalloc for phi may fail and causes a NULL pointer dereference. This patch avoids such a scenario. Signed-off-by: Aditya Pakki Signed-off-by: David S. Miller --- diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c index 124ff530da82a..26e3182bbca87 100644 --- a/drivers/isdn/hardware/mISDN/hfcsusb.c +++ b/drivers/isdn/hardware/mISDN/hfcsusb.c @@ -263,6 +263,9 @@ hfcsusb_ph_info(struct hfcsusb *hw) int i; phi = kzalloc(struct_size(phi, bch, dch->dev.nrbchan), GFP_ATOMIC); + if (!phi) + return; + phi->dch.ch.protocol = hw->protocol; phi->dch.ch.Flags = dch->Flags; phi->dch.state = dch->state;