[TOKENRING]: Use interrupt-safe locking with rif_lock.

Change operations on rif_lock from spin_{un}lock_bh to
spin_{un}lock_irq{save,restore} equivalents. Some of the
rif_lock critical sections are called from interrupt context via
tr_type_trans->tr_add_rif_info. The TR NIC drivers call tr_type_trans
from their packet receive handlers.

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Jay Vosburgh and committed by David S. Miller 001dd250 6be382ea

+12 -10
+12 -10
net/802/tr.c
··· 251 unsigned int hash; 252 struct rif_cache *entry; 253 unsigned char *olddata; 254 static const unsigned char mcast_func_addr[] 255 = {0xC0,0x00,0x00,0x04,0x00,0x00}; 256 257 - spin_lock_bh(&rif_lock); 258 259 /* 260 * Broadcasts are single route as stated in RFC 1042 ··· 324 else 325 slack = 18 - ((ntohs(trh->rcf) & TR_RCF_LEN_MASK)>>8); 326 olddata = skb->data; 327 - spin_unlock_bh(&rif_lock); 328 329 skb_pull(skb, slack); 330 memmove(skb->data, olddata, sizeof(struct trh_hdr) - slack); ··· 338 static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev) 339 { 340 unsigned int hash, rii_p = 0; 341 struct rif_cache *entry; 342 343 344 - spin_lock_bh(&rif_lock); 345 346 /* 347 * Firstly see if the entry exists ··· 380 if(!entry) 381 { 382 printk(KERN_DEBUG "tr.c: Couldn't malloc rif cache entry !\n"); 383 - spin_unlock_bh(&rif_lock); 384 return; 385 } 386 ··· 422 } 423 entry->last_used=jiffies; 424 } 425 - spin_unlock_bh(&rif_lock); 426 } 427 428 /* ··· 432 static void rif_check_expire(unsigned long dummy) 433 { 434 int i; 435 - unsigned long next_interval = jiffies + sysctl_tr_rif_timeout/2; 436 437 - spin_lock_bh(&rif_lock); 438 439 for(i =0; i < RIF_TABLE_SIZE; i++) { 440 struct rif_cache *entry, **pentry; ··· 456 } 457 } 458 459 - spin_unlock_bh(&rif_lock); 460 461 mod_timer(&rif_timer, next_interval); 462 ··· 487 488 static void *rif_seq_start(struct seq_file *seq, loff_t *pos) 489 { 490 - spin_lock_bh(&rif_lock); 491 492 return *pos ? rif_get_idx(*pos - 1) : SEQ_START_TOKEN; 493 } ··· 518 519 static void rif_seq_stop(struct seq_file *seq, void *v) 520 { 521 - spin_unlock_bh(&rif_lock); 522 } 523 524 static int rif_seq_show(struct seq_file *seq, void *v)
··· 251 unsigned int hash; 252 struct rif_cache *entry; 253 unsigned char *olddata; 254 + unsigned long flags; 255 static const unsigned char mcast_func_addr[] 256 = {0xC0,0x00,0x00,0x04,0x00,0x00}; 257 258 + spin_lock_irqsave(&rif_lock, flags); 259 260 /* 261 * Broadcasts are single route as stated in RFC 1042 ··· 323 else 324 slack = 18 - ((ntohs(trh->rcf) & TR_RCF_LEN_MASK)>>8); 325 olddata = skb->data; 326 + spin_unlock_irqrestore(&rif_lock, flags); 327 328 skb_pull(skb, slack); 329 memmove(skb->data, olddata, sizeof(struct trh_hdr) - slack); ··· 337 static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev) 338 { 339 unsigned int hash, rii_p = 0; 340 + unsigned long flags; 341 struct rif_cache *entry; 342 343 344 + spin_lock_irqsave(&rif_lock, flags); 345 346 /* 347 * Firstly see if the entry exists ··· 378 if(!entry) 379 { 380 printk(KERN_DEBUG "tr.c: Couldn't malloc rif cache entry !\n"); 381 + spin_unlock_irqrestore(&rif_lock, flags); 382 return; 383 } 384 ··· 420 } 421 entry->last_used=jiffies; 422 } 423 + spin_unlock_irqrestore(&rif_lock, flags); 424 } 425 426 /* ··· 430 static void rif_check_expire(unsigned long dummy) 431 { 432 int i; 433 + unsigned long flags, next_interval = jiffies + sysctl_tr_rif_timeout/2; 434 435 + spin_lock_irqsave(&rif_lock, flags); 436 437 for(i =0; i < RIF_TABLE_SIZE; i++) { 438 struct rif_cache *entry, **pentry; ··· 454 } 455 } 456 457 + spin_unlock_irqrestore(&rif_lock, flags); 458 459 mod_timer(&rif_timer, next_interval); 460 ··· 485 486 static void *rif_seq_start(struct seq_file *seq, loff_t *pos) 487 { 488 + spin_lock_irq(&rif_lock); 489 490 return *pos ? rif_get_idx(*pos - 1) : SEQ_START_TOKEN; 491 } ··· 516 517 static void rif_seq_stop(struct seq_file *seq, void *v) 518 { 519 + spin_unlock_irq(&rif_lock); 520 } 521 522 static int rif_seq_show(struct seq_file *seq, void *v)