Skip to content

Commit

Permalink
caif: unlock on error path in cfserl_receive()
Browse files Browse the repository at this point in the history
There was an spin_unlock missing on the error path.  The spin_lock was
tucked in with the declarations so it was hard to spot.  I added a new
line.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Sjur Brændeland <sjurbren@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed May 29, 2010
1 parent c196b02 commit 97dc875
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/caif/cfserl.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,18 @@ static int cfserl_receive(struct cflayer *l, struct cfpkt *newpkt)
u8 stx = CFSERL_STX;
int ret;
u16 expectlen = 0;

caif_assert(newpkt != NULL);
spin_lock(&layr->sync);

if (layr->incomplete_frm != NULL) {

layr->incomplete_frm =
cfpkt_append(layr->incomplete_frm, newpkt, expectlen);
pkt = layr->incomplete_frm;
if (pkt == NULL)
if (pkt == NULL) {
spin_unlock(&layr->sync);
return -ENOMEM;
}
} else {
pkt = newpkt;
}
Expand Down

0 comments on commit 97dc875

Please sign in to comment.