summaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_pscsi.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2013-04-02 18:33:58 -0700
committerOlof Johansson <olof@lixom.net>2013-04-02 18:33:58 -0700
commit06b851e58b73a268f8092c2d990f697b2e7c53bd (patch)
treea44e10462a39202b60636f8b102376a9c69169c1 /drivers/target/target_core_pscsi.c
parent5f03dc2002f5dc85ce87e69caff7f28f17f5c9b2 (diff)
parent17e7979f83c1de305fa81efb0aa7a3a56bd8121c (diff)
Merge branch 'lpc32xx/defconfig' of git://git.antcom.de/linux-2.6 into next/soc
* 'lpc32xx/defconfig' of git://git.antcom.de/linux-2.6: (604 commits) ARM: LPC32xx: defconfig update: Cleanup (EXPERIMENTAL) ARM: LPC32xx: defconfig update: Remove the museum NAND option ARM: LPC32xx: defconfig update: Default drivers and cleanup ARM: LPC32xx: defconfig update: gpio and keys + Linux 3.9-rc4 Signed-off-by: Olof Johansson <olof@lixom.net> Conflicts: arch/arm/Kconfig
Diffstat (limited to 'drivers/target/target_core_pscsi.c')
-rw-r--r--drivers/target/target_core_pscsi.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index 82e78d72fdb..e992b27aa09 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -883,7 +883,14 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
pr_debug("PSCSI: i: %d page: %p len: %d off: %d\n", i,
page, len, off);
- while (len > 0 && data_len > 0) {
+ /*
+ * We only have one page of data in each sg element,
+ * we can not cross a page boundary.
+ */
+ if (off + len > PAGE_SIZE)
+ goto fail;
+
+ if (len > 0 && data_len > 0) {
bytes = min_t(unsigned int, len, PAGE_SIZE - off);
bytes = min(bytes, data_len);
@@ -940,9 +947,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
bio = NULL;
}
- len -= bytes;
data_len -= bytes;
- off = 0;
}
}