From: Spencer Baugh <sbaugh@catern.com>
To: "Nicholas A. Bellinger" <nab@linux-iscsi.org>,
Sagi Grimberg <sagig@mellanox.com>,
Christoph Hellwig <hch@lst.de>,
Bart Van Assche <bart.vanassche@sandisk.com>,
Andy Grover <agrover@redhat.com>,
Christophe Vu-Brugier <cvubrugier@fastmail.fm>,
"open list:TARGET SUBSYSTEM" <linux-scsi@vger.kernel.org>,
"open list:TARGET SUBSYSTEM" <target-devel@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Cc: joern@purestorage.com, Alexei Potashnik <alexei@purestorage.com>
Subject: [PATCH] target/iscsi: fix digest computation for chained SGs
Date: Mon, 20 Jul 2015 17:12:12 -0700 [thread overview]
Message-ID: <1437437534-17931-1-git-send-email-sbaugh@catern.com> (raw)
From: Alexei Potashnik <alexei@purestorage.com>
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 <alexei@purestorage.com>
---
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) {
--
2.4.3
next reply other threads:[~2015-07-21 0:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-21 0:12 Spencer Baugh [this message]
2015-07-21 8:57 ` [PATCH] target/iscsi: fix digest computation for chained SGs Sagi Grimberg
2015-07-22 1:38 ` Roland Dreier
2015-07-31 6:27 ` Nicholas A. Bellinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1437437534-17931-1-git-send-email-sbaugh@catern.com \
--to=sbaugh@catern.com \
--cc=agrover@redhat.com \
--cc=alexei@purestorage.com \
--cc=bart.vanassche@sandisk.com \
--cc=cvubrugier@fastmail.fm \
--cc=hch@lst.de \
--cc=joern@purestorage.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=nab@linux-iscsi.org \
--cc=sagig@mellanox.com \
--cc=target-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox