* [PATCH] mISDN: prevent possible NULL pointer dereference
@ 2016-02-17 16:19 Anton Protopopov
2016-02-18 20:00 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Anton Protopopov @ 2016-02-17 16:19 UTC (permalink / raw)
To: Karsten Keil, netdev, linux-kernel; +Cc: Anton Protopopov
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>
---
drivers/isdn/hardware/mISDN/netjet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c
index 8e29447..afde4ed 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;
--
2.6.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mISDN: prevent possible NULL pointer dereference
2016-02-17 16:19 [PATCH] mISDN: prevent possible NULL pointer dereference Anton Protopopov
@ 2016-02-18 20:00 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-02-18 20:00 UTC (permalink / raw)
To: a.s.protopopov; +Cc: isdn, netdev, linux-kernel
From: Anton Protopopov <a.s.protopopov@gmail.com>
Date: Wed, 17 Feb 2016 11:19:56 -0500
> 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>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-02-18 20:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-17 16:19 [PATCH] mISDN: prevent possible NULL pointer dereference Anton Protopopov
2016-02-18 20:00 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).