stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Varun Prakash <varun@chelsio.com>,
	Bart Van Assche <bart.vanassche@sandisk.com>,
	Nicholas Bellinger <nab@linux-iscsi.org>,
	Sasha Levin <alexander.levin@verizon.com>
Subject: [PATCH 4.4 43/46] target/iscsi: Fix unsolicited data seq_end_offset calculation
Date: Thu, 19 Oct 2017 15:49:19 +0200	[thread overview]
Message-ID: <20171019134847.831805555@linuxfoundation.org> (raw)
In-Reply-To: <20171019134845.293630834@linuxfoundation.org>

4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Varun Prakash <varun@chelsio.com>


[ Upstream commit 4d65491c269729a1e3b375c45e73213f49103d33 ]

In case of unsolicited data for the first sequence
seq_end_offset must be set to minimum of total data length
and FirstBurstLength, so do not add cmd->write_data_done
to the min of total data length and FirstBurstLength.

This patch avoids that with ImmediateData=Yes, InitialR2T=No,
MaxXmitDataSegmentLength < FirstBurstLength that a WRITE command
with IO size above FirstBurstLength triggers sequence error
messages, for example

Set following parameters on target (linux-4.8.12)
ImmediateData = Yes
InitialR2T = No
MaxXmitDataSegmentLength = 8k
FirstBurstLength = 64k

Log in from Open iSCSI initiator and execute
dd if=/dev/zero of=/dev/sdb bs=128k count=1 oflag=direct

Error messages on target
Command ITT: 0x00000035 with Offset: 65536, Length: 8192 outside
of Sequence 73728:131072 while DataSequenceInOrder=Yes.
Command ITT: 0x00000035, received DataSN: 0x00000001 higher than
expected 0x00000000.
Unable to perform within-command recovery while ERL=0.

Signed-off-by: Varun Prakash <varun@chelsio.com>
[ bvanassche: Use min() instead of open-coding it / edited patch description ]
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>

Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/target/iscsi/iscsi_target_erl0.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/drivers/target/iscsi/iscsi_target_erl0.c
+++ b/drivers/target/iscsi/iscsi_target_erl0.c
@@ -44,10 +44,8 @@ void iscsit_set_dataout_sequence_values(
 	 */
 	if (cmd->unsolicited_data) {
 		cmd->seq_start_offset = cmd->write_data_done;
-		cmd->seq_end_offset = (cmd->write_data_done +
-			((cmd->se_cmd.data_length >
-			  conn->sess->sess_ops->FirstBurstLength) ?
-			 conn->sess->sess_ops->FirstBurstLength : cmd->se_cmd.data_length));
+		cmd->seq_end_offset = min(cmd->se_cmd.data_length,
+					conn->sess->sess_ops->FirstBurstLength);
 		return;
 	}
 

  parent reply	other threads:[~2017-10-19 13:54 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-19 13:48 [PATCH 4.4 00/46] 4.4.94-stable review Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 01/46] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 02/46] drm/dp/mst: save vcpi with payloads Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 03/46] MIPS: Fix minimum alignment requirement of IRQ stack Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 04/46] sctp: potential read out of bounds in sctp_ulpevent_type_enabled() Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 05/46] bpf/verifier: reject BPF_ALU64|BPF_END Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 06/46] udpv6: Fix the checksum computation when HW checksum does not apply Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 07/46] ip6_gre: skb_push ipv6hdr before packing the header in ip6gre_header Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 08/46] net: emac: Fix napi poll list corruption Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 09/46] packet: hold bind lock when rebinding to fanout hook Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 10/46] bpf: one perf event close wont free bpf program attached by another perf event Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 11/46] isdn/i4l: fetch the ppp_write buffer in one shot Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 12/46] vti: fix use after free in vti_tunnel_xmit/vti6_tnl_xmit Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 13/46] l2tp: Avoid schedule while atomic in exit_net Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 14/46] l2tp: fix race condition in l2tp_tunnel_delete Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 15/46] tun: bail out from tun_get_user() if the skb is empty Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 16/46] packet: in packet_do_bind, test fanout with bind_lock held Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 17/46] packet: only test po->has_vnet_hdr once in packet_snd Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 18/46] net: Set sk_prot_creator when cloning sockets to the right proto Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 19/46] tipc: use only positive error codes in messages Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 20/46] Revert "bsg-lib: dont free job in bsg_prepare_job" Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 22/46] watchdog: kempld: fix gcc-4.3 build Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 23/46] irqchip/crossbar: Fix incorrect type of local variables Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 24/46] mac80211_hwsim: check HWSIM_ATTR_RADIO_NAME length Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 25/46] mac80211: fix power saving clients handling in iwlwifi Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 26/46] net/mlx4_en: fix overflow in mlx4_en_init_timestamp() Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 27/46] netfilter: nf_ct_expect: Change __nf_ct_expect_check() return value Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 28/46] iio: adc: xilinx: Fix error handling Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 29/46] Btrfs: send, fix failure to rename top level inode due to name collision Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 30/46] f2fs: do not wait for writeback in write_begin Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 31/46] md/linear: shutup lockdep warnning Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 32/46] sparc64: Migrate hvcons irq to panicked cpu Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 33/46] net/mlx4_core: Fix VF overwrite of module param which disables DMFS on new probed PFs Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 34/46] crypto: xts - Add ECB dependency Greg Kroah-Hartman
2017-11-10 20:40   ` Ben Hutchings
2017-11-13 19:04     ` alexander.levin
2017-10-19 13:49 ` [PATCH 4.4 35/46] ocfs2/dlmglue: prepare tracking logic to avoid recursive cluster lock Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 36/46] slub: do not merge cache if slub_debug contains a never-merge flag Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 37/46] scsi: scsi_dh_emc: return success in clariion_std_inquiry() Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 38/46] net: mvpp2: release reference to txq_cpu[] entry after unmapping Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 39/46] i2c: at91: ensure state is restored after suspending Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 40/46] ceph: clean up unsafe d_parent accesses in build_dentry_path Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 41/46] uapi: fix linux/rds.h userspace compilation errors Greg Kroah-Hartman
2017-11-12 18:50   ` Ben Hutchings
2017-11-13 19:03     ` alexander.levin
2017-10-19 13:49 ` [PATCH 4.4 42/46] uapi: fix linux/mroute6.h " Greg Kroah-Hartman
2017-10-19 13:49 ` Greg Kroah-Hartman [this message]
2017-10-19 13:49 ` [PATCH 4.4 44/46] nfsd/callback: Cleanup callback cred on shutdown Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 45/46] cpufreq: CPPC: add ACPI_PROCESSOR dependency Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 46/46] Revert "tty: goldfish: Fix a parameter of a call to free_irq" Greg Kroah-Hartman
2017-10-19 22:18 ` [PATCH 4.4 00/46] 4.4.94-stable review Tom Gall
2017-10-20  6:26   ` Greg Kroah-Hartman
2017-10-20 16:54     ` Tom Gall
2017-10-21  7:25       ` Greg Kroah-Hartman
2017-10-21 14:37         ` Tom Gall
2017-10-20 13:05 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171019134847.831805555@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=alexander.levin@verizon.com \
    --cc=bart.vanassche@sandisk.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    --cc=stable@vger.kernel.org \
    --cc=varun@chelsio.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).