linux/net/x25
Julia Lawall 76975f8a31 [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 <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-04 00:47:02 -08:00
..
Kconfig [NET]: move config options out to individual protocols 2005-07-11 21:13:56 -07:00
Makefile [X.25]: Add call forwarding 2007-02-08 13:34:02 -08:00
af_x25.c [NET]: Forget the zero_it argument of sk_alloc() 2007-11-01 00:39:31 -07:00
sysctl_net_x25.c [PATCH] sysctl: remove insert_at_head from register_sysctl 2007-02-14 08:09:59 -08:00
x25_dev.c [NET]: Make packet reception network namespace safe 2007-10-10 16:49:08 -07:00
x25_facilities.c [NET] X25: Fix whitespace errors. 2007-02-10 23:20:22 -08:00
x25_forward.c [X25]: Add missing x25_neigh_put 2008-01-04 00:47:02 -08:00
x25_in.c [SK_BUFF]: Some more conversions to skb_copy_from_linear_data 2007-04-25 22:28:30 -07:00
x25_link.c [NET] X25: Fix whitespace errors. 2007-02-10 23:20:22 -08:00
x25_out.c [SK_BUFF]: Introduce skb_copy_to_linear_data{_offset} 2007-04-25 22:28:29 -07:00
x25_proc.c [NET]: Make /proc/net per network namespace 2007-10-10 16:49:06 -07:00
x25_route.c [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
x25_subr.c [X25]: allow ITU-T DTE facilities for x25 2006-03-22 00:01:31 -08:00
x25_timer.c [NET] X25: Fix whitespace errors. 2007-02-10 23:20:22 -08:00