diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-05-20 20:10:29 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-05-20 20:25:24 -0400 |
commit | f80e8ed3951455272c12693e35b259be8eb60b30 (patch) | |
tree | 0b348e90da1ce8e98d45346084ad2a1be47cbc78 /drivers/target | |
parent | b1e41d8cd43910fee82f27ab1381bc6cd66910b3 (diff) |
iscsi-target: Fix iov_count calculation bug in iscsit_allocate_iovecs
This patch fixes a bug in iscsit_allocate_iovecs() where iov_count was
incorrectly calculated using min(1UL, data_length / PAGE_SIZE) instead of
max(1UL, data_length / PAGE_SIZE), that ends up triggering an OOPs for
large block I/O when the SGL <-> iovec mapping exceeds the bogus iov_count
allocation size.
This is a regression introduced during the iscsi-target conversion back
to using core memory allocation here:
commit bfb79eac2026b411df9e253a9c350039b4b04bb7
Author: Andy Grover <agrover@redhat.com>
Date: Tue Apr 3 15:51:29 2012 -0700
target/iscsi: Go back to core allocating data buffer for cmd
Cc: Andy Grover <agrover@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/iscsi/iscsi_target.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index e39947105ab1..d57d10cb2e47 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -760,7 +760,7 @@ static void iscsit_ack_from_expstatsn(struct iscsi_conn *conn, u32 exp_statsn) | |||
760 | 760 | ||
761 | static int iscsit_allocate_iovecs(struct iscsi_cmd *cmd) | 761 | static int iscsit_allocate_iovecs(struct iscsi_cmd *cmd) |
762 | { | 762 | { |
763 | u32 iov_count = min(1UL, DIV_ROUND_UP(cmd->se_cmd.data_length, PAGE_SIZE)); | 763 | u32 iov_count = max(1UL, DIV_ROUND_UP(cmd->se_cmd.data_length, PAGE_SIZE)); |
764 | 764 | ||
765 | iov_count += ISCSI_IOV_DATA_BUFFER; | 765 | iov_count += ISCSI_IOV_DATA_BUFFER; |
766 | 766 | ||