netdev
[Top] [All Lists]

[PATCH PKT_SCHED 12/17]: Fix missing unlock in ipt action error path

To: jamal <hadi@xxxxxxxxxx>
Subject: [PATCH PKT_SCHED 12/17]: Fix missing unlock in ipt action error path
From: Patrick McHardy <kaber@xxxxxxxxx>
Date: Thu, 30 Dec 2004 04:40:33 +0100
Cc: Maillist netdev <netdev@xxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5
Fix missing unlock in ipt action error path.

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/12/30 03:02:56+01:00 kaber@xxxxxxxxxxxx 
#   [PKT_SCHED]: Fix missing unlock in ipt action error path
#   
#   Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
# 
# net/sched/ipt.c
#   2004/12/30 02:57:03+01:00 kaber@xxxxxxxxxxxx +6 -4
#   [PKT_SCHED]: Fix missing unlock in ipt action error path
#   
#   Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
# 
diff -Nru a/net/sched/ipt.c b/net/sched/ipt.c
--- a/net/sched/ipt.c   2004-12-30 04:01:46 +01:00
+++ b/net/sched/ipt.c   2004-12-30 04:01:46 +01:00
@@ -248,9 +248,11 @@
        p->bstats.bytes += skb->len;
        p->bstats.packets++;
 
-       if (skb_cloned(skb) ) {
-               if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
-                       return -1;
+       if (skb_cloned(skb)) {
+               if (unlikely(pskb_expand_head(skb, 0, 0, GFP_ATOMIC))) {
+                       result = -1;
+                       goto out_unlock;
+               }
        }
        /* yes, we have to worry about both in and out dev
         worry later - danger - this API seems to have changed
@@ -275,9 +277,9 @@
                result = TC_POLICE_OK;
                break;
        }
+out_unlock:
        spin_unlock(&p->lock);
        return result;
-
 }
 
 static int
<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH PKT_SCHED 12/17]: Fix missing unlock in ipt action error path, Patrick McHardy <=