* [PATCH] target/iscsi: fix digest computation for chained SGs
@ 2015-07-21 0:12 ` Spencer Baugh
0 siblings, 0 replies; 5+ messages in thread
From: Spencer Baugh @ 2015-07-21 0:12 UTC (permalink / raw)
To: 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
Cc: joern, Alexei Potashnik
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] target/iscsi: fix digest computation for chained SGs
@ 2015-07-21 0:12 ` Spencer Baugh
0 siblings, 0 replies; 5+ messages in thread
From: Spencer Baugh @ 2015-07-21 0:12 UTC (permalink / raw)
To: 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
Cc: joern, Alexei Potashnik
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] target/iscsi: fix digest computation for chained SGs
2015-07-21 0:12 ` Spencer Baugh
(?)
@ 2015-07-21 8:57 ` Sagi Grimberg
2015-07-22 1:38 ` Roland Dreier
-1 siblings, 1 reply; 5+ messages in thread
From: Sagi Grimberg @ 2015-07-21 8:57 UTC (permalink / raw)
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
Cc: joern, Alexei Potashnik
On 7/21/2015 3:12 AM, Spencer Baugh wrote:
> 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) {
>
How were you able to get a chained SG list in the target code?
In any event, looks good,
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] target/iscsi: fix digest computation for chained SGs
2015-07-21 8:57 ` Sagi Grimberg
@ 2015-07-22 1:38 ` Roland Dreier
2015-07-31 6:27 ` Nicholas A. Bellinger
0 siblings, 1 reply; 5+ messages in thread
From: Roland Dreier @ 2015-07-22 1:38 UTC (permalink / raw)
To: Sagi Grimberg
Cc: 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, Joern Engel,
Alexei Potashnik
On Tue, Jul 21, 2015 at 1:57 AM, Sagi Grimberg <sagig@dev.mellanox.co.il> wrote:
> How were you able to get a chained SG list in the target code?
Local hack. So this bug can't be hit in current mainline code, but
patch improves the code and removes a hidden booby-trap, so I think it
makes sense to apply.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] target/iscsi: fix digest computation for chained SGs
2015-07-22 1:38 ` Roland Dreier
@ 2015-07-31 6:27 ` Nicholas A. Bellinger
0 siblings, 0 replies; 5+ messages in thread
From: Nicholas A. Bellinger @ 2015-07-31 6:27 UTC (permalink / raw)
To: Roland Dreier
Cc: Sagi Grimberg, Spencer Baugh, Sagi Grimberg, Christoph Hellwig,
Bart Van Assche, Andy Grover, Christophe Vu-Brugier,
open list:TARGET SUBSYSTEM, open list:TARGET SUBSYSTEM,
open list, Joern Engel, Alexei Potashnik
On Tue, 2015-07-21 at 18:38 -0700, Roland Dreier wrote:
> On Tue, Jul 21, 2015 at 1:57 AM, Sagi Grimberg <sagig@dev.mellanox.co.il> wrote:
> > How were you able to get a chained SG list in the target code?
>
> Local hack. So this bug can't be hit in current mainline code, but
> patch improves the code and removes a hidden booby-trap, so I think it
> makes sense to apply.
> --
Applied to target-pending/for-next.
Thanks Roland & Co.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-07-31 6:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-21 0:12 [PATCH] target/iscsi: fix digest computation for chained SGs Spencer Baugh
2015-07-21 0:12 ` Spencer Baugh
2015-07-21 8:57 ` Sagi Grimberg
2015-07-22 1:38 ` Roland Dreier
2015-07-31 6:27 ` Nicholas A. Bellinger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.