public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Shlomo Pongratz <shlomop@mellanox.com>
To: linux-scsi@vger.kernel.org
Cc: jayamohank@serverengines.com, michaelc@cs.wisc.edu
Subject: Possible reentrancy issue in be_iopoll
Date: Mon, 18 Mar 2013 17:11:51 +0200	[thread overview]
Message-ID: <51472EB7.2020903@mellanox.com> (raw)

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.


             reply	other threads:[~2013-03-18 15:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-18 15:11 Shlomo Pongratz [this message]
2013-03-19 19:42 ` Possible reentrancy issue in be_iopoll Kallickal, Jayamohan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51472EB7.2020903@mellanox.com \
    --to=shlomop@mellanox.com \
    --cc=jayamohank@serverengines.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox