mbox series

[V3,0/3] Fix possible hangs and race conditions during login

Message ID 20230508162219.1731964-1-mlombard@redhat.com (mailing list archive)
Headers show
Series Fix possible hangs and race conditions during login | expand

Message

Maurizio Lombardi May 8, 2023, 4:22 p.m. UTC
PATCH 1 fixes a possible hang when during a login operation the initiator
stops sending data to the target and the login_work doesn't get scheduled.

PATCH 3 fixes a bug in iscsi_target_locate_portal(), in the error
code path the login semaphore may end up being released even if
no one called down() against it, this may allow
multiple threads to access the semaphore-protected code.

v3: fix the comments' format

v2: the login timeout of 15 seconds now is relative to the entire
    login operation and not per-PDU.


Maurizio Lombardi (3):
  target: iscsi: fix hang in the iSCSI login code
  target: iscsi: remove unused transport_timer
  target: iscsi: prevent login threads from racing between each other

 drivers/target/iscsi/iscsi_target.c       |  2 -
 drivers/target/iscsi/iscsi_target_login.c | 63 ++-----------------
 drivers/target/iscsi/iscsi_target_nego.c  | 74 +++++++++++++----------
 drivers/target/iscsi/iscsi_target_util.c  | 51 ++++++++++++++++
 drivers/target/iscsi/iscsi_target_util.h  |  4 ++
 include/target/iscsi/iscsi_target_core.h  |  7 ++-
 6 files changed, 106 insertions(+), 95 deletions(-)

Comments

Mike Christie May 20, 2023, 5:42 p.m. UTC | #1
On 5/8/23 11:22 AM, Maurizio Lombardi wrote:
> PATCH 1 fixes a possible hang when during a login operation the initiator
> stops sending data to the target and the login_work doesn't get scheduled.
> 
> PATCH 3 fixes a bug in iscsi_target_locate_portal(), in the error
> code path the login semaphore may end up being released even if
> no one called down() against it, this may allow
> multiple threads to access the semaphore-protected code.
> 
> v3: fix the comments' format
> 
> v2: the login timeout of 15 seconds now is relative to the entire
>     login operation and not per-PDU.
> 

Reviewed-by: Mike Christie <michael.christie@oracle.com>
Martin K. Petersen May 22, 2023, 10:45 p.m. UTC | #2
On Mon, 08 May 2023 18:22:16 +0200, Maurizio Lombardi wrote:

> PATCH 1 fixes a possible hang when during a login operation the initiator
> stops sending data to the target and the login_work doesn't get scheduled.
> 
> PATCH 3 fixes a bug in iscsi_target_locate_portal(), in the error
> code path the login semaphore may end up being released even if
> no one called down() against it, this may allow
> multiple threads to access the semaphore-protected code.
> 
> [...]

Applied to 6.4/scsi-fixes, thanks!

[1/3] target: iscsi: fix hang in the iSCSI login code
      https://git.kernel.org/mkp/scsi/c/13247018d68f
[2/3] target: iscsi: remove unused transport_timer
      https://git.kernel.org/mkp/scsi/c/98a8c2bf938a
[3/3] target: iscsi: prevent login threads from racing between each other
      https://git.kernel.org/mkp/scsi/c/2a737d3b8c79