summaryrefslogtreecommitdiff
path: root/drivers/scsi/iscsi_boot_sysfs.c
diff options
context:
space:
mode:
authorBodo Stroesser <bstroesser@ts.fujitsu.com>2020-05-28 22:31:08 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2020-06-03 04:23:47 +0300
commit8c4e0f212398cdd1eb4310a5981d06a723cdd24f (patch)
tree2f2f804cb107ac2216ad0dada551b71756a5f173 /drivers/scsi/iscsi_boot_sysfs.c
parent22617e21633142dd2b81541cb3b95d6fb59aa85f (diff)
downloadlinux-8c4e0f212398cdd1eb4310a5981d06a723cdd24f.tar.xz
scsi: target: tcmu: Fix size in calls to tcmu_flush_dcache_range
1) If remaining ring space before the end of the ring is smaller then the next cmd to write, tcmu writes a padding entry which fills the remaining space at the end of the ring. Then tcmu calls tcmu_flush_dcache_range() with the size of struct tcmu_cmd_entry as data length to flush. If the space filled by the padding was smaller then tcmu_cmd_entry, tcmu_flush_dcache_range() is called for an address range reaching behind the end of the vmalloc'ed ring. tcmu_flush_dcache_range() in a loop calls flush_dcache_page(virt_to_page(start)); for every page being part of the range. On x86 the line is optimized out by the compiler, as flush_dcache_page() is empty on x86. But I assume the above can cause trouble on other architectures that really have a flush_dcache_page(). For paddings only the header part of an entry is relevant due to alignment rules the header always fits in the remaining space, if padding is needed. So tcmu_flush_dcache_range() can safely be called with sizeof(entry->hdr) as the length here. 2) After it has written a command to cmd ring, tcmu calls tcmu_flush_dcache_range() using the size of a struct tcmu_cmd_entry as data length to flush. But if a command needs many iovecs, the real size of the command may be bigger then tcmu_cmd_entry, so a part of the written command is not flushed then. Link: https://lore.kernel.org/r/20200528193108.9085-1-bstroesser@ts.fujitsu.com Acked-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/iscsi_boot_sysfs.c')
0 files changed, 0 insertions, 0 deletions