From: Shlomo Pongratz Date: Sat, 6 Apr 2013 03:38:36 +0000 (-0700) Subject: [SCSI] be2iscsi: Fix possible reentrancy issue in be_iopoll X-Git-Tag: firefly_0821_release~3680^2~485^2~1^2~66 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ad3f428e0fbab1f306cbc22340e9f7672a49147f;p=firefly-linux-kernel-4.4.55.git [SCSI] be2iscsi: Fix possible reentrancy issue in 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! When this routine is called from more than one thread of execution, than 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; Fix - remove the "static" Signed-off-by: Shlomo Pongratz Signed-off-by: Jayamohan Kallickal Reviewed-by: Mike Christie Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 228d33181912..fe30e3fe7eed 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -2191,7 +2191,7 @@ void beiscsi_process_all_cqs(struct work_struct *work) static int be_iopoll(struct blk_iopoll *iop, int budget) { - static unsigned int ret; + unsigned int ret; struct beiscsi_hba *phba; struct be_eq_obj *pbe_eq;