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

From: Paolo Bonzini
Date: Wed Sep 05 2012 - 11:14:58 EST


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@xxxxxxxxxx>
---
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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/