Skip to contentSkip to conversation

caif: unlock on error path in cfserl_receive()

PATCH Applied Dan Carpenter 3 participants 3 messages May 26, 2010 – May 29, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 caif: unlock on error path in cfserl_receive()

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.

net/caif/cfserl.c +4 -2
index cb4325a..965c5ba 100644
@@ -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;
 	}
Acked-by Sjur Braendeland on v1 1/1
#1 lore raw

Hi Dan.

Quoted 5 lines · Dan Carpenter

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.

Acked-by Sjur Braendeland

Well spotted! Thanks for reviewing and fixing this.

Regards
Sjur

maintainer Applied
#2 lore raw

From: Sjur Brændeland <[email protected]>
Date: Wed, 26 May 2010 20:18:36 +0200

Quoted 9 lines

Hi Dan.

Quoted 5 lines · Dan Carpenter

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.

Acked-by Sjur Braendeland

Applied.

Sjur, in the future please provide your full email address in
Acked-by: lines just as you would for a Signed-off-by: tag.

I fixed it up this time.

Thanks.