• Masato Suzuki's avatar
    scsi: sd_zbc: Fix sd_zbc_report_zones() buffer allocation · 85b8532e
    Masato Suzuki authored
    commit 515ce606 upstream.
    
    The function sd_zbc_do_report_zones() issues a REPORT ZONES command with a
    buffer size calculated based on the number of zones requested by the
    caller. This value should however not exceed the capabilities of the
    hardware maximum command size, that is, should not exceed the
    max_hw_sectors limit of the device. This problem leads to failures of
    report zones commands when re-validating disks with some SAS HBAs.
    
    Fix this by limiting a report zone command buffer size to the minimum of
    the device max_hw_sectors and calculated value based on the requested
    number of zones. This does not change the semantic of the report_zones file
    operation as report zones can always return less zone reports than
    requested. Short reports are handled using a loop execution of the
    report_zones file operation in the function blk_report_zones().
    
    [Damien]
    Before patch 'e76239a3 ("block: add a report_zones method")', report
    zones buffer allocation was limited to max_sectors when allocated in
    blk_report_zones(). This however does not consider the actual format of the
    device reply which is interface dependent.  Limiting the allocation based
    on the size of the expected reply format rather than the size of the array
    of generic sturct blkzone passed by blk_report_zones() makes more sense.
    
    Fixes: e76239a3 ("block: add a report_zones method")
    Cc: stable@vger.kernel.org
    Signed-off-by: 's avatarMasato Suzuki <masato.suzuki@wdc.com>
    Signed-off-by: 's avatarDamien Le Moal <damien.lemoal@wdc.com>
    Signed-off-by: Martin K. Petersen's avatarMartin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    85b8532e
Name
Last commit
Last update
..
aacraid Loading commit data...
aic7xxx Loading commit data...
aic94xx Loading commit data...
arcmsr Loading commit data...
arm Loading commit data...
be2iscsi Loading commit data...
bfa Loading commit data...
bnx2fc Loading commit data...
bnx2i Loading commit data...
csiostor Loading commit data...
cxgbi Loading commit data...
cxlflash Loading commit data...
device_handler Loading commit data...
dpt Loading commit data...
esas2r Loading commit data...
fcoe Loading commit data...
fnic Loading commit data...
hisi_sas Loading commit data...
ibmvscsi Loading commit data...
ibmvscsi_tgt Loading commit data...
isci Loading commit data...
libfc Loading commit data...
libsas Loading commit data...
lpfc Loading commit data...
megaraid Loading commit data...
mpt3sas Loading commit data...
mvsas Loading commit data...
osd Loading commit data...
pcmcia Loading commit data...
pm8001 Loading commit data...
qedf Loading commit data...
qedi Loading commit data...
qla2xxx Loading commit data...
qla4xxx Loading commit data...
smartpqi Loading commit data...
snic Loading commit data...
sym53c8xx_2 Loading commit data...
ufs Loading commit data...
.gitignore Loading commit data...
3w-9xxx.c Loading commit data...
3w-9xxx.h Loading commit data...
3w-sas.c Loading commit data...
3w-sas.h Loading commit data...
3w-xxxx.c Loading commit data...
3w-xxxx.h Loading commit data...
53c700.c Loading commit data...
53c700.h Loading commit data...
53c700.scr Loading commit data...
53c700_d.h_shipped Loading commit data...
BusLogic.c Loading commit data...
BusLogic.h Loading commit data...
FlashPoint.c Loading commit data...
Kconfig Loading commit data...
Makefile Loading commit data...
NCR5380.c Loading commit data...
NCR5380.h Loading commit data...
a100u2w.c Loading commit data...
a100u2w.h Loading commit data...
a2091.c Loading commit data...
a2091.h Loading commit data...
a3000.c Loading commit data...
a3000.h Loading commit data...
a4000t.c Loading commit data...
advansys.c Loading commit data...
aha152x.c Loading commit data...
aha152x.h Loading commit data...
aha1542.c Loading commit data...
aha1542.h Loading commit data...
aha1740.c Loading commit data...
aha1740.h Loading commit data...
am53c974.c Loading commit data...
atari_scsi.c Loading commit data...
atp870u.c Loading commit data...
atp870u.h Loading commit data...
bvme6000_scsi.c Loading commit data...
ch.c Loading commit data...
constants.c Loading commit data...
dc395x.c Loading commit data...
dc395x.h Loading commit data...
dmx3191d.c Loading commit data...
dpt_i2o.c Loading commit data...
dpti.h Loading commit data...
esp_scsi.c Loading commit data...
esp_scsi.h Loading commit data...
g_NCR5380.c Loading commit data...
gdth.c Loading commit data...
gdth.h Loading commit data...
gdth_ioctl.h Loading commit data...
gdth_proc.c Loading commit data...
gdth_proc.h Loading commit data...
gvp11.c Loading commit data...
gvp11.h Loading commit data...
hosts.c Loading commit data...
hpsa.c Loading commit data...
hpsa.h Loading commit data...
hpsa_cmd.h Loading commit data...
hptiop.c Loading commit data...
hptiop.h Loading commit data...
imm.c Loading commit data...
imm.h Loading commit data...
initio.c Loading commit data...
initio.h Loading commit data...
ipr.c Loading commit data...
ipr.h Loading commit data...
ips.c Loading commit data...
ips.h Loading commit data...
iscsi_boot_sysfs.c Loading commit data...
iscsi_tcp.c Loading commit data...
iscsi_tcp.h Loading commit data...
jazz_esp.c Loading commit data...
lasi700.c Loading commit data...
libiscsi.c Loading commit data...
libiscsi_tcp.c Loading commit data...
mac53c94.c Loading commit data...
mac53c94.h Loading commit data...
mac_esp.c Loading commit data...
mac_scsi.c Loading commit data...
megaraid.c Loading commit data...
megaraid.h Loading commit data...
mesh.c Loading commit data...
mesh.h Loading commit data...
mvme147.c Loading commit data...
mvme147.h Loading commit data...
mvme16x_scsi.c Loading commit data...
mvumi.c Loading commit data...
mvumi.h Loading commit data...
myrb.c Loading commit data...
myrb.h Loading commit data...
myrs.c Loading commit data...
myrs.h Loading commit data...
ncr53c8xx.c Loading commit data...
ncr53c8xx.h Loading commit data...
nsp32.c Loading commit data...
nsp32.h Loading commit data...
nsp32_debug.c Loading commit data...
nsp32_io.h Loading commit data...
osst.c Loading commit data...
osst.h Loading commit data...
osst_detect.h Loading commit data...
osst_options.h Loading commit data...
pmcraid.c Loading commit data...
pmcraid.h Loading commit data...
ppa.c Loading commit data...
ppa.h Loading commit data...
ps3rom.c Loading commit data...
qla1280.c Loading commit data...
qla1280.h Loading commit data...
qlogicfas.c Loading commit data...
qlogicfas408.c Loading commit data...
qlogicfas408.h Loading commit data...
qlogicpti.c Loading commit data...
qlogicpti.h Loading commit data...
raid_class.c Loading commit data...
script_asm.pl Loading commit data...
scsi.c Loading commit data...
scsi.h Loading commit data...
scsi_common.c Loading commit data...
scsi_debug.c Loading commit data...
scsi_debugfs.c Loading commit data...
scsi_debugfs.h Loading commit data...
scsi_devinfo.c Loading commit data...
scsi_dh.c Loading commit data...
scsi_error.c Loading commit data...
scsi_ioctl.c Loading commit data...
scsi_lib.c Loading commit data...
scsi_lib_dma.c Loading commit data...
scsi_logging.c Loading commit data...
scsi_logging.h Loading commit data...
scsi_netlink.c Loading commit data...
scsi_pm.c Loading commit data...
scsi_priv.h Loading commit data...
scsi_proc.c Loading commit data...
scsi_sas_internal.h Loading commit data...
scsi_scan.c Loading commit data...
scsi_sysctl.c Loading commit data...
scsi_sysfs.c Loading commit data...
scsi_trace.c Loading commit data...
scsi_transport_api.h Loading commit data...
scsi_transport_fc.c Loading commit data...
scsi_transport_iscsi.c Loading commit data...
scsi_transport_sas.c Loading commit data...
scsi_transport_spi.c Loading commit data...
scsi_transport_srp.c Loading commit data...
scsicam.c Loading commit data...
sd.c Loading commit data...
sd.h Loading commit data...
sd_dif.c Loading commit data...
sd_zbc.c Loading commit data...
sense_codes.h Loading commit data...
ses.c Loading commit data...
sg.c Loading commit data...
sgiwd93.c Loading commit data...
sim710.c Loading commit data...
sni_53c710.c Loading commit data...
sr.c Loading commit data...
sr.h Loading commit data...
sr_ioctl.c Loading commit data...
sr_vendor.c Loading commit data...
st.c Loading commit data...
st.h Loading commit data...
st_options.h Loading commit data...
stex.c Loading commit data...
storvsc_drv.c Loading commit data...
sun3_scsi.c Loading commit data...
sun3_scsi_vme.c Loading commit data...
sun3x_esp.c Loading commit data...
sun_esp.c Loading commit data...
virtio_scsi.c Loading commit data...
vmw_pvscsi.c Loading commit data...
vmw_pvscsi.h Loading commit data...
wd33c93.c Loading commit data...
wd33c93.h Loading commit data...
wd719x.c Loading commit data...
wd719x.h Loading commit data...
xen-scsifront.c Loading commit data...
zalon.c Loading commit data...
zorro7xx.c Loading commit data...
zorro_esp.c Loading commit data...