Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=76975f8a3186dae501584d0155ea410464f62815
Commit:     76975f8a3186dae501584d0155ea410464f62815
Parent:     304b46996ca1a989fe0fe99831ed38c79e855245
Author:     Julia Lawall <[EMAIL PROTECTED]>
AuthorDate: Tue Jan 1 19:30:30 2008 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Fri Jan 4 00:47:02 2008 -0800

    [X25]: Add missing x25_neigh_put
    
    The function x25_get_neigh increments a reference count.  At the point of
    the second goto out, the result of calling x25_get_neigh is only stored in
    a local variable, and thus no one outside the function will be able to
    decrease the reference count.  Thus, x25_neigh_put should be called before
    the return in this case.
    
    The problem was found using the following semantic match.
    (http://www.emn.fr/x-info/coccinelle/)
    
    // <smpl>
    
    @@
    type T,T1,T2;
    identifier E;
    statement S;
    expression x1,x2,x3;
    int ret;
    @@
    
      T E;
      ...
    * if ((E = x25_get_neigh(...)) == NULL)
      S
      ... when != x25_neigh_put(...,(T1)E,...)
          when != if (E != NULL) { ... x25_neigh_put(...,(T1)E,...); ...}
          when != x1 = (T1)E
          when != E = x3;
          when any
      if (...) {
        ... when != x25_neigh_put(...,(T2)E,...)
            when != if (E != NULL) { ... x25_neigh_put(...,(T2)E,...); ...}
            when != x2 = (T2)E
    (
    *   return;
    |
    *   return ret;
    )
      }
    // </smpl>
    
    Signed-off-by: Julia Lawall <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/x25/x25_forward.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/x25/x25_forward.c b/net/x25/x25_forward.c
index 8738ec7..3447803 100644
--- a/net/x25/x25_forward.c
+++ b/net/x25/x25_forward.c
@@ -118,13 +118,14 @@ int x25_forward_data(int lci, struct x25_neigh *from, 
struct sk_buff *skb) {
                goto out;
 
        if ( (skbn = pskb_copy(skb, GFP_ATOMIC)) == NULL){
-               goto out;
+               goto output;
 
        }
        x25_transmit_link(skbn, nb);
 
-       x25_neigh_put(nb);
        rc = 1;
+output:
+       x25_neigh_put(nb);
 out:
        return rc;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to