Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753575AbbGUI6X (ORCPT ); Tue, 21 Jul 2015 04:58:23 -0400 Received: from mail-wg0-f52.google.com ([74.125.82.52]:34096 "EHLO mail-wg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752444AbbGUI6U (ORCPT ); Tue, 21 Jul 2015 04:58:20 -0400 Subject: Re: [PATCH] target/iscsi: fix digest computation for chained SGs To: Spencer Baugh , "Nicholas A. Bellinger" , Sagi Grimberg , Christoph Hellwig , Bart Van Assche , Andy Grover , Christophe Vu-Brugier , "open list:TARGET SUBSYSTEM" , "open list:TARGET SUBSYSTEM" , open list References: <1437437534-17931-1-git-send-email-sbaugh@catern.com> Cc: joern@purestorage.com, Alexei Potashnik From: Sagi Grimberg Message-ID: <55AE0995.2010209@dev.mellanox.co.il> Date: Tue, 21 Jul 2015 11:57:57 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: <1437437534-17931-1-git-send-email-sbaugh@catern.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1778 Lines: 55 On 7/21/2015 3:12 AM, Spencer Baugh wrote: > From: Alexei Potashnik > > Current implementation assumes that all the buffers of an IO are linked > with a single SG list. Which makes it fail if SG chaining is used. > > Signed-off-by: Alexei Potashnik > --- > drivers/target/iscsi/iscsi_target.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c > index 4e68b62..a4cf58c 100644 > --- a/drivers/target/iscsi/iscsi_target.c > +++ b/drivers/target/iscsi/iscsi_target.c > @@ -1209,7 +1209,6 @@ static u32 iscsit_do_crypto_hash_sg( > u8 *pad_bytes) > { > u32 data_crc; > - u32 i; > struct scatterlist *sg; > unsigned int page_off; > > @@ -1218,15 +1217,15 @@ static u32 iscsit_do_crypto_hash_sg( > sg = cmd->first_data_sg; > page_off = cmd->first_data_sg_off; > > - i = 0; > while (data_length) { > - u32 cur_len = min_t(u32, data_length, (sg[i].length - page_off)); > + u32 cur_len = min_t(u32, data_length, (sg->length - page_off)); > > - crypto_hash_update(hash, &sg[i], cur_len); > + crypto_hash_update(hash, sg, cur_len); > > data_length -= cur_len; > page_off = 0; > - i++; > + /* iscsit_map_iovec has already checked for invalid sg pointers */ > + sg = sg_next(sg); > } > > if (padding) { > How were you able to get a chained SG list in the target code? In any event, looks good, Reviewed-by: Sagi Grimberg -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/