* 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
* RE: Possible reentrancy issue in be_iopoll
2013-03-18 15:11 Possible reentrancy issue in be_iopoll Shlomo Pongratz
@ 2013-03-19 19:42 ` Kallickal, Jayamohan
0 siblings, 0 replies; 2+ messages in thread
From: Kallickal, Jayamohan @ 2013-03-19 19:42 UTC (permalink / raw)
To: Shlomo Pongratz, linux-scsi@vger.kernel.org; +Cc: michaelc@cs.wisc.edu
Shlomo,
Thanks for the review and spotting this issue.
Will fix this and include in the next submission, unless you want to do it yourself.
Thanks
Jay
-----Original Message-----
From: Shlomo Pongratz [mailto:shlomop@mellanox.com]
Sent: Monday, March 18, 2013 8:12 AM
To: linux-scsi@vger.kernel.org
Cc: Kallickal, Jayamohan; michaelc@cs.wisc.edu
Subject: Possible reentrancy issue in be_iopoll
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