scsi: iscsi: Fix shost->max_id use
authorMike Christie <michael.christie@oracle.com>
Tue, 25 May 2021 18:18:07 +0000 (13:18 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:17:49 +0000 (16:17 +0200)
commit57b8430c75a9382fd2e66e181ca5e11ad1ea31aa
tree134501c95c9115416e1ad79655647199ebc50e30
parent7b5ddec4b8c270f5c0493055ef0d0b6b6194b303
scsi: iscsi: Fix shost->max_id use

[ Upstream commit bdd4aad7ff92ae39c2e93c415bb6761cb8b584da ]

The iscsi offload drivers are setting the shost->max_id to the max number
of sessions they support. The problem is that max_id is not the max number
of targets but the highest identifier the targets can have. To use it to
limit the number of targets we need to set it to max sessions - 1, or we
can end up with a session we might not have preallocated resources for.

Link: https://lore.kernel.org/r/20210525181821.7617-15-michael.christie@oracle.com
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/be2iscsi/be_main.c
drivers/scsi/bnx2i/bnx2i_iscsi.c
drivers/scsi/cxgbi/libcxgbi.c
drivers/scsi/qedi/qedi_main.c