[RFC PATCH 1/3] tcm_iscsi: warn on incorrect precondition for iscsit_do_crypto_hash_sg

Paolo Bonzini
2012-09-05T15:14:04Z

While iscsit_do_crypto_hash_sg does look at cmd->first_data_sg_off
when computing cur_len, it ignores it completely when computing the
hash. As a result, the first cmd->first_data_sg_off bytes are
included in the hash even though they should not. Warn if this
happens.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
drivers/target/iscsi/iscsi_target.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 97c0f78..224679e 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -1135,6 +1135,7 @@ static u32 iscsit_do_crypto_hash_sg(

sg = cmd->first_data_sg;
page_off = cmd->first_data_sg_off;
+ WARN_ON(page_off != sg->offset);

i = 0;
while (data_length) {
--
1.7.1