Commit 597cdbc2239e6019bbb2dd73b266f436166f0427

Authored by Eric Dumazet
Committed by David S. Miller
1 parent a5e7424d42

atm: clip: remove clip_tbl

Commit 32092ecf0644 (atm: clip: Use device neigh support on top of
"arp_tbl".) introduced a bug since clip_tbl is zeroed : Crash occurs in
__neigh_for_each_release()

idle_timer_check() must use instead arp_tbl and neigh_check_cb() should
ignore non clip neighbours.

Idea from David Miller.

Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Tested-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 6 additions and 4 deletions Side-by-side Diff

... ... @@ -46,8 +46,8 @@
46 46  
47 47 static struct net_device *clip_devs;
48 48 static struct atm_vcc *atmarpd;
49   -static struct neigh_table clip_tbl;
50 49 static struct timer_list idle_timer;
  50 +static const struct neigh_ops clip_neigh_ops;
51 51  
52 52 static int to_atmarpd(enum atmarp_ctrl_type type, int itf, __be32 ip)
53 53 {
... ... @@ -123,6 +123,8 @@
123 123 struct atmarp_entry *entry = neighbour_priv(n);
124 124 struct clip_vcc *cv;
125 125  
  126 + if (n->ops != &clip_neigh_ops)
  127 + return 0;
126 128 for (cv = entry->vccs; cv; cv = cv->next) {
127 129 unsigned long exp = cv->last_use + cv->idle_timeout;
128 130  
129 131  
... ... @@ -154,10 +156,10 @@
154 156  
155 157 static void idle_timer_check(unsigned long dummy)
156 158 {
157   - write_lock(&clip_tbl.lock);
158   - __neigh_for_each_release(&clip_tbl, neigh_check_cb);
  159 + write_lock(&arp_tbl.lock);
  160 + __neigh_for_each_release(&arp_tbl, neigh_check_cb);
159 161 mod_timer(&idle_timer, jiffies + CLIP_CHECK_INTERVAL * HZ);
160   - write_unlock(&clip_tbl.lock);
  162 + write_unlock(&arp_tbl.lock);
161 163 }
162 164  
163 165 static int clip_arp_rcv(struct sk_buff *skb)