public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix target not properly truncating command data length
@ 2021-02-09  7:22 Aleksandr Miloserdov
  2021-02-09  7:22 ` [PATCH 1/2] scsi: target: core: Add cmd length set before cmd complete Aleksandr Miloserdov
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Aleksandr Miloserdov @ 2021-02-09  7:22 UTC (permalink / raw)
  To: target-devel
  Cc: linux-scsi, martin.petersen, r.bolshakov, Aleksandr Miloserdov

SPC-5 (4.2.5.6 Allocation length) requires to terminate transfers to the
Data In Buffer when the number of bytes or blocks specified by the
ALLOCATION LENGTH field have been transferred or when all available data
have been transferred, whichever is less.

PERSISTENT RESERVE IN service actions in TCM don't follow the clause and
return ALLOCATION LENGTH of data, even if actual number of data in reply
is less (e.g. there are no reservation keys).

That causes an underflow and a failure in libiscsi PrinReadKeys.Simple
that expects Data In Buffer size equal to ADDITIONAL LENGTH + 8.

This patch series fixes this behavior.
It is intended for 5.11/scsi-queue branch.

Aleksandr Miloserdov (2):
  scsi: target: core: Add cmd length set before cmd complete
  scsi: target: core: Prevent underflow for service actions

 drivers/target/target_core_pr.c        |  6 ++++++
 drivers/target/target_core_transport.c | 15 +++++++++++----
 include/target/target_core_backend.h   |  1 +
 3 files changed, 18 insertions(+), 4 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-02-26  2:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-09  7:22 [PATCH 0/2] Fix target not properly truncating command data length Aleksandr Miloserdov
2021-02-09  7:22 ` [PATCH 1/2] scsi: target: core: Add cmd length set before cmd complete Aleksandr Miloserdov
2021-02-09 17:30   ` Bodo Stroesser
2021-02-09  7:22 ` [PATCH 2/2] scsi: target: core: Prevent underflow for service actions Aleksandr Miloserdov
2021-02-09 17:31   ` Bodo Stroesser
2021-02-23  3:22 ` [PATCH 0/2] Fix target not properly truncating command data length Martin K. Petersen
2021-02-26  2:22 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox