diff options
author | Michael Brown <mcb30@ipxe.org> | 2023-02-16 12:54:47 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2023-02-16 13:27:25 +0000 |
commit | 2733c4763a50b9eb0c206e7430d4d0638451e5e9 (patch) | |
tree | 7424d7a6708b8435aac95fe27cd477c68f897a10 /src/drivers | |
parent | cff857461be443339aa39d614635d9a4eae8f8b2 (diff) | |
download | ipxe-2733c4763a50b9eb0c206e7430d4d0638451e5e9.tar.gz |
[iscsi] Limit maximum transfer size to MaxBurstLengthiscsicap
We currently specify only the iSCSI default value for MaxBurstLength
and ignore any negotiated value, since our internal block device API
allows only for receiving directly into caller-allocated buffers and
so we have no intrinsic limit on burst length.
A conscientious target may however refuse to attempt a transfer that
we request for a number of blocks that would exceed the negotiated
maximum burst length.
Fix by recording the negotiated maximum burst length and using it to
limit the maximum number of blocks per transfer as reported by the
SCSI layer.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/block/scsi.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/drivers/block/scsi.c b/src/drivers/block/scsi.c index f765c9762..ff415f5c6 100644 --- a/src/drivers/block/scsi.c +++ b/src/drivers/block/scsi.c @@ -609,6 +609,7 @@ static void scsicmd_read_capacity_cmd ( struct scsi_command *scsicmd, */ static void scsicmd_read_capacity_done ( struct scsi_command *scsicmd, int rc ) { + struct scsi_device *scsidev = scsicmd->scsidev; struct scsi_read_capacity_private *priv = scsicmd_priv ( scsicmd ); struct scsi_capacity_16 *capacity16 = &priv->capacity.capacity16; struct scsi_capacity_10 *capacity10 = &priv->capacity.capacity10; @@ -645,6 +646,9 @@ static void scsicmd_read_capacity_done ( struct scsi_command *scsicmd, } capacity.max_count = -1U; + /* Allow transport layer to update capacity */ + block_capacity ( &scsidev->scsi, &capacity ); + /* Return capacity to caller */ block_capacity ( &scsicmd->block, &capacity ); |