Possible suspect code in iscsit_map_iovec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It seems to me the code in iscsit_map_iovec doesn't quite work in certain cases
if the sg from the transport layer has offsets in their pages. 

In the simplest case where there is a problem, assume the first scatterlist
entry has an offset. Now also assume that this is a write and we will receive
immediate data and then data out PDU's because the command is large. 

Lets say immediate data is 64K and the total command size is 256 K.

Now the first receive will work fine since it contains data_offset = 0 and we
use sg->offset in the loop for every sg entry. Now let us say the first page has
offset 2K. Then on the next data out PDU, we will get data_offset = 0x10000
(data_offset seems to come from hdr->offset). Now we don't take into account the
offsets of the pages we have already received (in this case) in the immediate
data as part of the first PDU. This causes us to have an offset into sg entry 16
with page_offset 0, which is incorrect since we should be in sg entry 16 and
page_offset 2K.

The problem is clearly much worse if each entry in the sg has its own offset and
not just the first one.

I know this is not a manifested bug in existing code because the way transport
code allocates the sg is transport_generic_get_mem does not cause a problem
since it is always offset 0. But since the iscsi code uses sg->offset, we
probably should do it correctly if the sg was ever setup with page offsets in it.

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux