[PATCH] fix for buggy variable reuse in riotable.c (244ac18)

From: Rasmus Andersen (rasmus@jaquet.dk)
Date: Sun May 27 2001 - 14:40:33 EST


Forgot l-k when sending this off...

----- Forwarded message from Rasmus Andersen <rasmus@jaquet.dk> -----

Hi.

The following patch fixes a buggy variable reuse i drivers/char/
rio/riotable.c (244-ac18) as reported by the stanford team way
back.

--- linux-244-ac18-clean/drivers/char/rio/riotable.c Sun May 27 20:19:56 2001
+++ linux-244-ac18/drivers/char/rio/riotable.c Sun May 27 21:12:16 2001
@@ -501,7 +501,7 @@
         struct Map *HostMapP;
         struct Port *PortP;
         int work_done = 0;
- unsigned long flags;
+ unsigned long lock_flags, sem_flags;
 
         rio_dprintk (RIO_DEBUG_TABLE, "Delete entry on host %x, rta %x\n",
                                                                 MapP->HostUniqueNum, MapP->RtaUniqueNum);
@@ -509,10 +509,10 @@
         for ( host=0; host < p->RIONumHosts; host++ ) {
                 HostP = &p->RIOHosts[host];
 
- rio_spin_lock_irqsave( &HostP->HostLock, flags );
+ rio_spin_lock_irqsave( &HostP->HostLock, lock_flags );
 
                 if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) {
- rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
+ rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags);
                         continue;
                 }
 
@@ -529,7 +529,7 @@
                                         if ( HostMapP->Topology[link].Unit != ROUTE_DISCONNECT ) {
                                                 rio_dprintk (RIO_DEBUG_TABLE, "Entry is in use and cannot be deleted!\n");
                                                 p->RIOError.Error = UNIT_IS_IN_USE;
- rio_spin_unlock_irqrestore( &HostP->HostLock, flags);
+ rio_spin_unlock_irqrestore( &HostP->HostLock, lock_flags);
                                                 return EBUSY;
                                         }
                                 }
@@ -544,7 +544,7 @@
                                                 PortP = p->RIOPortp[port];
                                                 rio_dprintk (RIO_DEBUG_TABLE, "Unmap port\n");
 
- rio_spin_lock_irqsave( &PortP->portSem, flags );
+ rio_spin_lock_irqsave( &PortP->portSem, sem_flags );
 
                                                 PortP->Mapped = 0;
 
@@ -602,7 +602,7 @@
                                                         WWORD(PortP->PhbP->destination,
                                                          dest_unit + (dest_port << 8));
                                                 }
- rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+ rio_spin_unlock_irqrestore(&PortP->portSem, sem_flags);
                                         }
                                 }
                                 rio_dprintk (RIO_DEBUG_TABLE, "Entry nulled.\n");
@@ -610,7 +610,7 @@
                                 work_done++;
                         }
                 }
- rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
+ rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags);
         }
 
         /* XXXXX lock me up */

-- 
Regards,
        Rasmus(rasmus@jaquet.dk)

We're going to turn this team around 360 degrees. -Jason Kidd, upon his drafting to the Dallas Mavericks

----- End forwarded message ----- - 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 : Thu May 31 2001 - 21:00:34 EST