public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* Possible reentrancy issue in be_iopoll
@ 2013-03-18 15:11 Shlomo Pongratz
  2013-03-19 19:42 ` Kallickal, Jayamohan
  0 siblings, 1 reply; 2+ messages in thread
From: Shlomo Pongratz @ 2013-03-18 15:11 UTC (permalink / raw)
  To: linux-scsi; +Cc: jayamohank, michaelc

Hi Jayamohan.

I think that there is a reentrancy issue in 
"drivers/scsi/be2iscsi/be_main.c::be_iopoll".
The driver creates "NAPI" context per core which is fine, however the 
above routine declares the ret variable as static!
Thus there is only one instance of this variable, so if this routine is 
called from more than one thread of execution the result is unpredictable.

         static unsigned int ret;
         .....

         ret = beiscsi_process_cq(pbe_eq);
<----------------------------------------------------------------------------------Another 
thread can enter here and change "ret".
         if (ret < budget) {
                ....
         }
<----------------------------------------------------------------------------------Another 
thread can enter here and change "ret".
         return ret;

I can't submit a patch without checking it first, which is impossible 
since I don't have the HW, but the fix seems trivial, just take out the 
static.

Best regards,

S.P.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-19 19:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-18 15:11 Possible reentrancy issue in be_iopoll Shlomo Pongratz
2013-03-19 19:42 ` Kallickal, Jayamohan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox