The allocation length is used to limit the maximum amount of variable length data (e.g., mode data, log data, diagnostic data) returned to an application client. If the information being transferred to the Data-In Buffer includes fields containing counts of the number of bytes in some or all of the data, then the contents of these fields shall not be altered to reflect the truncation, if any, that results from an insufficient ALLOCATION LENGTH value, unless this manual describes the Data-In Buffer format states otherwise.
See SCSI Command Manual (2.2.6):
Linux scsi driver sends the first request with len = 4 and the next request with a length known from a response: https://github.com/torvalds/linux/blob/master/drivers/scsi/sd.c#L2668-L2682
Before this PR linux couldn't read the Caching page:
After the PR caching modes are being read successfully: