diff options
author | Aditya Pakki <pakki001@umn.edu> | 2019-03-02 15:20:43 -0600 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-03-04 10:54:48 -0800 |
commit | 38d22659803a033b1b66cd2624c33570c0dde77d (patch) | |
tree | 15a363c12bb76a8b0c1897dfce0e0b6d61a7f756 | |
parent | 72d8b4fdbfb6192cec1ce25c46020fb48b62fa1e (diff) | |
download | linux-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>
-rw-r--r-- | drivers/isdn/hardware/mISDN/hfcsusb.c | 3 |
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; |