Re: [PATCH] This patch adds check for NopOUT->flag.

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

 



Hi Arshad!

On Fri, 2014-03-14 at 16:42 +0530, Arshad Hussain wrote:
> This patch adds check for NopOUT->flag (LMB) which is a mandatory as per RFC 3720 Section 10.18. 
> 
> Signed-off-by: Arshad Hussain <arshad.hussain@xxxxxxxxxxxxxx>
> ---
>  drivers/target/iscsi/iscsi_target.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
> index b83ec37..94b15be 100644
> --- a/drivers/target/iscsi/iscsi_target.c
> +++ b/drivers/target/iscsi/iscsi_target.c
> @@ -1503,6 +1503,12 @@ int iscsit_setup_nop_out(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
>  {
>         u32 payload_length = ntoh24(hdr->dlength);
> 
> +       if (!(hdr->flags & ISCSI_FLAG_CMD_FINAL)) {
> +               pr_err("NopOUT Flag's, Left Most Bit not set, protocol error.\n");
> +               return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR,
> +                               (unsigned char *)hdr);
> +       }
> +
>         if (hdr->itt == RESERVED_ITT && !(hdr->opcode & ISCSI_OP_IMMEDIATE)) {
>                 pr_err("NOPOUT ITT is reserved, but Immediate Bit is"
>                         " not set, protocol error.\n");
> --
> 1.8.1.4

Note this patch doesn't apply against target-pending/for-next due to
some recent iscsit_setup_nop_out() parameter changes..

So I've fixed it up this time, and added one other change to follow what
the other checks in iscsit_setup_nop_out() are already doing.

For future reference, please make sure patches apply to the current
for-next HEAD.

Below is the end result that has been added to for-next.

Thanks!

--nab

>From b3e853b56149148b5d60f56baf812630f8861036 Mon Sep 17 00:00:00 2001
From: Arshad Hussain <arshad.hussain@xxxxxxxxxxxxxx>
Date: Fri, 14 Mar 2014 15:28:59 -0700
Subject: [PATCH] iscsi-target: Add missing NopOUT->flag (LMB) sanity check

This patch adds check for NopOUT->flag (LMB) which is a mandatory
as per RFC 3720 Section 10.18.

(Fix up context changes for v3.14-rc code - nab)

Signed-off-by: Arshad Hussain <arshad.hussain@xxxxxxxxxxxxxx>
Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
---
 drivers/target/iscsi/iscsi_target.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index b83ec37..df0456a 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -1503,6 +1503,16 @@ int iscsit_setup_nop_out(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
 {
 	u32 payload_length = ntoh24(hdr->dlength);
 
+	if (!(hdr->flags & ISCSI_FLAG_CMD_FINAL)) {
+		pr_err("NopOUT Flag's, Left Most Bit not set, protocol error.\n");
+		if (!cmd)
+			return iscsit_add_reject(conn, ISCSI_REASON_PROTOCOL_ERROR,
+						 (unsigned char *)hdr);
+		
+		return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR,
+					 (unsigned char *)hdr);
+	}
+
 	if (hdr->itt == RESERVED_ITT && !(hdr->opcode & ISCSI_OP_IMMEDIATE)) {
 		pr_err("NOPOUT ITT is reserved, but Immediate Bit is"
 			" not set, protocol error.\n");
-- 
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