Skip to content
Commit ab22d260 authored by Xiubo Li's avatar Xiubo Li Committed by Nicholas Bellinger
Browse files

tcmu: Fix possible overwrite of t_data_sg's last iov[]



If there has BIDI data, its first iov[] will overwrite the last
iov[] for se_cmd->t_data_sg.

To fix this, we can just increase the iov pointer, but this may
introuduce a new memory leakage bug: If the se_cmd->data_length
and se_cmd->t_bidi_data_sg->length are all not aligned up to the
DATA_BLOCK_SIZE, the actual length needed maybe larger than just
sum of them.

So, this could be avoided by rounding all the data lengthes up
to DATA_BLOCK_SIZE.

Reviewed-by: default avatarMike Christie <mchristi@redhat.com>
Tested-by: default avatarIlias Tsitsimpis <iliastsi@arrikto.com>
Reviewed-by: default avatarBryant G. Ly <bryantly@linux.vnet.ibm.com>
Signed-off-by: default avatarXiubo Li <lixiubo@cmss.chinamobile.com>
Cc: stable@vger.kernel.org # 3.18+
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 49cb77e2
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment