summaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
authorAditya Pakki <pakki001@umn.edu>2019-03-02 22:20:43 +0100
committerDavid S. Miller <davem@davemloft.net>2019-03-04 19:54:48 +0100
commit38d22659803a033b1b66cd2624c33570c0dde77d (patch)
tree15a363c12bb76a8b0c1897dfce0e0b6d61a7f756 /drivers/isdn
parentnet: dsa: mv88e6xxx: support in-band signalling on SGMII ports with external ... (diff)
downloadlinux-38d22659803a033b1b66cd2624c33570c0dde77d.tar.xz
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;