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

From: Mike Phillips (phillim2@comcast.net)
Date: Tue Dec 03 2002 - 20:48:00 EST


All,

Here's a small patch that fixes a lock and potential oops when accessing
/proc/net/tr_rif is the token ring interface is under heavy load.

The patch also applies to 2.5.50 with a couple of lines offset.

Mike Phillips

diff -urN -x /home/phillim/dev/dontdiff linux-2.4.20.vanilla/net/802/tr.c linux-2.4.20/net/802/tr.c
--- linux-2.4.20.vanilla/net/802/tr.c 2002-08-02 20:39:46.000000000 -0400
+++ linux-2.4.20/net/802/tr.c 2002-12-03 20:28:35.000000000 -0500
@@ -468,6 +468,7 @@
         off_t pos=0;
         int size,i,j,rcf_len,segment,brdgnmb;
         unsigned long now=jiffies;
+ unsigned long flags;
 
         rif_cache entry;
 
@@ -476,7 +477,7 @@
         pos+=size;
         len+=size;
 
- spin_lock_bh(&rif_lock);
+ spin_lock_irqsave(&rif_lock,flags);
         for(i=0;i < RIF_TABLE_SIZE;i++)
         {
                 for(entry=rif_table[i];entry;entry=entry->next) {
@@ -525,7 +526,7 @@
                 if(pos>offset+length)
                         break;
         }
- spin_unlock_bh(&rif_lock);
+ spin_unlock_irqrestore(&rif_lock,flags);
 
         *start=buffer+(offset-begin); /* Start of wanted data */
         len-=(offset-begin); /* Start slop */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Dec 07 2002 - 22:00:17 EST