summaryrefslogtreecommitdiff
path: root/net/caif/cfserl.c
diff options
context:
space:
mode:
authorSjur Braendeland <sjur.brandeland@stericsson.com>2010-05-21 02:16:09 +0000
committerDavid S. Miller <davem@davemloft.net>2010-05-23 23:57:42 -0700
commit638e628a600a5c542d46dfb06771cf9c229ef5f3 (patch)
tree777d4d2b9aee8a1d4b0ce522bf3957023a9bfb7e /net/caif/cfserl.c
parent7aecf4944f2c05aafb73b4820e469c74b4ec8517 (diff)
caif: Bugfix - handle mem-allocation failures
Discovered bugs when injecting slab allocation failures. Add checks on all memory allocation. Signed-off-by: Sjur Braendeland <sjur.brandeland@stericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/caif/cfserl.c')
-rw-r--r--net/caif/cfserl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/caif/cfserl.c b/net/caif/cfserl.c
index 06029ea2da2f..cb4325a3dc83 100644
--- a/net/caif/cfserl.c
+++ b/net/caif/cfserl.c
@@ -67,6 +67,8 @@ static int cfserl_receive(struct cflayer *l, struct cfpkt *newpkt)
layr->incomplete_frm =
cfpkt_append(layr->incomplete_frm, newpkt, expectlen);
pkt = layr->incomplete_frm;
+ if (pkt == NULL)
+ return -ENOMEM;
} else {
pkt = newpkt;
}
@@ -154,7 +156,6 @@ static int cfserl_receive(struct cflayer *l, struct cfpkt *newpkt)
if (layr->usestx) {
if (tail_pkt != NULL)
pkt = cfpkt_append(pkt, tail_pkt, 0);
-
/* Start search for next STX if frame failed */
continue;
} else {