Commit 7f9f9f51 authored by Mike Phillips's avatar Mike Phillips Committed by Linus Torvalds

[PATCH] tr.c lockup when accessing /proc/net/tr_rif

This fixes a lock and potential oops when accessing /proc/net/tr_rif is
the token ring interface is under heavy load.
parent 2334d1d4
...@@ -465,6 +465,7 @@ static int rif_get_info(char *buffer,char **start, off_t offset, int length) ...@@ -465,6 +465,7 @@ static int rif_get_info(char *buffer,char **start, off_t offset, int length)
off_t pos=0; off_t pos=0;
int size,i,j,rcf_len,segment,brdgnmb; int size,i,j,rcf_len,segment,brdgnmb;
unsigned long now=jiffies; unsigned long now=jiffies;
unsigned long flags;
rif_cache entry; rif_cache entry;
...@@ -473,7 +474,7 @@ static int rif_get_info(char *buffer,char **start, off_t offset, int length) ...@@ -473,7 +474,7 @@ static int rif_get_info(char *buffer,char **start, off_t offset, int length)
pos+=size; pos+=size;
len+=size; len+=size;
spin_lock_bh(&rif_lock); spin_lock_irqsave(&rif_lock,flags);
for(i=0;i < RIF_TABLE_SIZE;i++) for(i=0;i < RIF_TABLE_SIZE;i++)
{ {
for(entry=rif_table[i];entry;entry=entry->next) { for(entry=rif_table[i];entry;entry=entry->next) {
...@@ -522,7 +523,7 @@ static int rif_get_info(char *buffer,char **start, off_t offset, int length) ...@@ -522,7 +523,7 @@ static int rif_get_info(char *buffer,char **start, off_t offset, int length)
if(pos>offset+length) if(pos>offset+length)
break; break;
} }
spin_unlock_bh(&rif_lock); spin_unlock_irqrestore(&rif_lock,flags);
*start=buffer+(offset-begin); /* Start of wanted data */ *start=buffer+(offset-begin); /* Start of wanted data */
len-=(offset-begin); /* Start slop */ len-=(offset-begin); /* Start slop */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment