caif: unlock on error path in cfserl_receive()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Tuesday, June 1, 2010 - 9:59 am

Gitweb:     http://git.kernel.org/linus/97dc875f90a7b88a9fa476c256345c0d40fcdf6c
Commit:     97dc875f90a7b88a9fa476c256345c0d40fcdf6c
Parent:     c196b02ce60d7b1f9bc62a62c5706d4d58fbfc5a
Author:     Dan Carpenter <error27@gmail.com>
AuthorDate: Wed May 26 05:16:48 2010 +0000
Committer:  David S. Miller <davem@davemloft.net>
CommitDate: Sat May 29 00:18:50 2010 -0700

    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.
    
    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>
---
 net/caif/cfserl.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/caif/cfserl.c b/net/caif/cfserl.c
index cb4325a..965c5ba 100644
--- a/net/caif/cfserl.c
+++ b/net/caif/cfserl.c
@@ -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;
 	}
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
caif: unlock on error path in cfserl_receive(), Linux Kernel Mailing ..., (Tue Jun 1, 9:59 am)