]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
scsi: sd: Consider max_xfer_blocks if opt_xfer_blocks is unusable
authorFam Zheng <famz@redhat.com>
Tue, 28 Mar 2017 04:41:26 +0000 (12:41 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 7 Apr 2017 21:05:15 +0000 (17:05 -0400)
commit6780414519f91c2a84da9baa963a940ac916f803
tree118f22f4a52c2389b90c19cccc0dce45068db62e
parenta3902ee98304324f681088203391b5c0353ce977
scsi: sd: Consider max_xfer_blocks if opt_xfer_blocks is unusable

If device reports a small max_xfer_blocks and a zero opt_xfer_blocks, we
end up using BLK_DEF_MAX_SECTORS, which is wrong and r/w of that size
may get error.

[mkp: tweaked to avoid setting rw_max twice and added typecast]

Cc: <stable@vger.kernel.org> # v4.4+
Fixes: ca369d51b3e ("block/sd: Fix device-imposed transfer length limits")
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sd.c