[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1572881182-37664-1-git-send-email-bianpan2016@163.com>
Date: Mon, 4 Nov 2019 23:26:22 +0800
From: Pan Bian <bianpan2016@....com>
To: Satish Kharat <satishkh@...co.com>,
Sesidhar Baddela <sebaddel@...co.com>,
Karan Tilak Kumar <kartilak@...co.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
Pan Bian <bianpan2016@....com>
Subject: [PATCH 1/1] scsi: fnic: fix use after free
The memory chunk io_req is released by mempool_free. Accessing
io_req->start_time will result in a use after free bug. Thevariable
start_time is a backup of the timestamp. So, use start_time here to
avoid use after free.
Signed-off-by: Pan Bian <bianpan2016@....com>
---
drivers/scsi/fnic/fnic_scsi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 80608b53897b..d3986a25d9c2 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -1024,7 +1024,8 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic,
atomic64_inc(&fnic_stats->io_stats.io_completions);
- io_duration_time = jiffies_to_msecs(jiffies) - jiffies_to_msecs(io_req->start_time);
+ io_duration_time = jiffies_to_msecs(jiffies) -
+ jiffies_to_msecs(start_time);
if(io_duration_time <= 10)
atomic64_inc(&fnic_stats->io_stats.io_btw_0_to_10_msec);
--
2.7.4
Powered by blists - more mailing lists