[RFC] target/alua: extern len check in target_emulate_set_target_port_groups() by one

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am not sure I know what I do. If cmd->data_length 4 then it does not
run into the "SET TARGET PORT GROUPS parameter list length too small"
error. Later ptr is assigned to &buf[4] which is only valid if length is
atleast 5 rigtht? Anyway, we never enter the while loop because "4 < 4"
not true and we leave with rc undefined.
Looking at the while loop, it reads ptr + 2 but we checked the size
until ptr so I am not sure whether this is correct or not.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
---
 drivers/target/target_core_alua.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
index 8ddab35..92f8eb1 100644
--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -220,7 +220,7 @@ target_emulate_set_target_port_groups(struct se_cmd *cmd)
 	if (!l_port)
 		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
 
-	if (cmd->data_length < 4) {
+	if (cmd->data_length <= 4) {
 		pr_warn("SET TARGET PORT GROUPS parameter list length %u too"
 			" small\n", cmd->data_length);
 		return TCM_INVALID_PARAMETER_LIST;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux