summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Protopopov <a.s.protopopov@gmail.com>2016-02-17 17:19:56 +0100
committerDavid S. Miller <davem@davemloft.net>2016-02-18 20:59:35 +0100
commite60b13e4f56fc56cc0dea845ce0711773d514149 (patch)
treec0f9077bbd5b4eb462d8865d526459335b0c61ef
parentnet: caif: fix erroneous return value (diff)
downloadlinux-e60b13e4f56fc56cc0dea845ce0711773d514149.tar.xz
linux-e60b13e4f56fc56cc0dea845ce0711773d514149.zip
mISDN: prevent possible NULL pointer dereference
A return value of the bchannel_get_rxbuf() function is compared with the positive ENOMEM value instead of the negative -ENOMEM value to detect a memory allocation problem. Thus, after a possible memory allocation failure the bc->bch.rx_skb will be NULL which will lead to a NULL pointer dereference. Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/isdn/hardware/mISDN/netjet.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c
index 8e2944784e00..afde4edef9ae 100644
--- a/drivers/isdn/hardware/mISDN/netjet.c
+++ b/drivers/isdn/hardware/mISDN/netjet.c
@@ -392,7 +392,7 @@ read_dma(struct tiger_ch *bc, u32 idx, int cnt)
}
stat = bchannel_get_rxbuf(&bc->bch, cnt);
/* only transparent use the count here, HDLC overun is detected later */
- if (stat == ENOMEM) {
+ if (stat == -ENOMEM) {
pr_warning("%s.B%d: No memory for %d bytes\n",
card->name, bc->bch.nr, cnt);
return;