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:05:41 +0000 (16:05 +0200)
commitfa7adae4b577ce04fc26b96cd0e630cfcf62e5e3
tree050fcb58adf594c261d489084a4f61fa3fb406fe
parent89812e7957ab0746eab66ed6fc49d52bb4dca250
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