Skip to contentSkip to conversation

scsi: fnic: fix use after free

PATCH Applied Pan Bian 2 participants 2 messages Nov 4, 2019 – Nov 5, 2019

Subsystems (2)
lore
Share & tools
lore

Pan Bian

author
#0 lore raw

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.

---
 drivers/scsi/fnic/fnic_scsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/fnic/fnic_scsi.c +2 -1
index 80608b53897b..d3986a25d9c2 100644
@@ -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);
Signature · 1 line
2.7.4
#1 lore raw

Pan,

Quoted 4 lines

The memory chunk io_req is released by mempool_free. Accessing io_req->start_time will result in a use after free bug. The variable start_time is a backup of the timestamp. So, use start_time here to avoid use after free.

Applied to 5.5/scsi-queue, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering