Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1336562 > unrolled thread
| Started by | Anton Protopopov <a.s.protopopov@gmail.com> |
|---|---|
| First post | 2016-02-17 17:30 +0100 |
| Last post | 2016-02-18 21:10 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] mISDN: prevent possible NULL pointer dereference Anton Protopopov <a.s.protopopov@gmail.com> - 2016-02-17 17:30 +0100
Re: [PATCH] mISDN: prevent possible NULL pointer dereference David Miller <davem@davemloft.net> - 2016-02-18 21:10 +0100
| From | Anton Protopopov <a.s.protopopov@gmail.com> |
|---|---|
| Date | 2016-02-17 17:30 +0100 |
| Subject | [PATCH] mISDN: prevent possible NULL pointer dereference |
| Message-ID | <r3d9j-uB-73@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2016-02-18 21:10 +0100 |
| Message-ID | <r3D3J-2sr-19@gated-at.bofh.it> |
| In reply to | #1336562 |
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.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web