summaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
authorAditya Pakki <pakki001@umn.edu>2019-03-02 15:20:43 -0600
committerDavid S. Miller <davem@davemloft.net>2019-03-04 10:54:48 -0800
commit38d22659803a033b1b66cd2624c33570c0dde77d (patch)
tree15a363c12bb76a8b0c1897dfce0e0b6d61a7f756 /drivers/isdn
parent72d8b4fdbfb6192cec1ce25c46020fb48b62fa1e (diff)
downloadlinux-38d22659803a033b1b66cd2624c33570c0dde77d.tar.gz
linux-38d22659803a033b1b66cd2624c33570c0dde77d.tar.bz2
linux-38d22659803a033b1b66cd2624c33570c0dde77d.zip
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 <pakki001@umn.edu> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn')
-rw-r--r--drivers/isdn/hardware/mISDN/hfcsusb.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c
index 124ff530da82..26e3182bbca8 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;