WSL2-Linux-Kernel/drivers/ata
Tejun Heo 729a6a300e libata: set queue DMA alignment to sector size for ATAPI too
ata_pio_sectors() expects buffer for each sector to be contained in a
single page; otherwise, it ends up overrunning the first page.  This
is achieved by setting queue DMA alignment.  If sector_size is smaller
than PAGE_SIZE and all buffers are sector_size aligned, buffer for
each sector is always contained in a single page.

This wasn't applied to ATAPI devices but IDENTIFY_PACKET is executed
as ATA_PROT_PIO and thus uses ata_pio_sectors().  Newer versions of
udev issue IDENTIFY_PACKET with unaligned buffer triggering the
problem and causing oops.

This patch fixes the problem by setting sdev->sector_size to
ATA_SECT_SIZE on ATATPI devices and always setting DMA alignment to
sector_size.  While at it, add a warning for the unlikely but still
possible scenario where sector_size is larger than PAGE_SIZE, in which
case the alignment wouldn't be enough.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: John Stanley <jpsinthemix@verizon.net>
Tested-by: John Stanley <jpsinthemix@verizon.net>
Cc: stable@kernel.org
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2011-01-28 03:16:20 -05:00
..
Kconfig
Makefile
acard-ahci.c
ahci.c ahci: add HFLAG_YES_FBS and apply it to 88SE9128 2011-01-28 03:07:04 -05:00
ahci.h
ahci_platform.c
ata_generic.c
ata_piix.c
libahci.c
libata-acpi.c
libata-core.c libata: DVR-212D can't do SETXFER DVD-RW DVR-212D 2011-01-28 03:16:04 -05:00
libata-eh.c
libata-pmp.c
libata-scsi.c libata: set queue DMA alignment to sector size for ATAPI too 2011-01-28 03:16:20 -05:00
libata-sff.c
libata-transport.c
libata-transport.h
libata.h
pata_acpi.c
pata_ali.c
pata_amd.c
pata_artop.c
pata_at32.c
pata_at91.c
pata_atiixp.c
pata_atp867x.c
pata_bf54x.c
pata_cmd64x.c
pata_cmd640.c
pata_cs5520.c
pata_cs5530.c
pata_cs5535.c
pata_cs5536.c
pata_cypress.c
pata_efar.c
pata_hpt3x2n.c pata_hpt{37x|3x2n}: use pr_*(DRV_NAME ...) instead of printk(KERN_* ...) 2011-01-28 03:07:04 -05:00
pata_hpt3x3.c
pata_hpt37x.c pata_hpt37x: inherit prereset() method for HPT374 2011-01-28 03:07:04 -05:00
pata_hpt366.c pata_hpt{366|37x}: use pr_warning(...) instead of printk(KERN_WARNING ...) 2011-01-28 03:07:04 -05:00
pata_icside.c
pata_isapnp.c
pata_it821x.c
pata_it8213.c
pata_ixp4xx_cf.c
pata_jmicron.c
pata_legacy.c
pata_macio.c
pata_marvell.c
pata_mpc52xx.c pata_mpc52xx: inherit from ata_bmdma_port_ops 2011-01-28 03:07:04 -05:00
pata_mpiix.c
pata_netcell.c
pata_ninja32.c
pata_ns87410.c
pata_ns87415.c
pata_octeon_cf.c
pata_of_platform.c
pata_oldpiix.c
pata_opti.c
pata_optidma.c
pata_palmld.c
pata_pcmcia.c
pata_pdc202xx_old.c
pata_pdc2027x.c
pata_piccolo.c
pata_platform.c
pata_pxa.c
pata_qdi.c
pata_radisys.c
pata_rb532_cf.c
pata_rdc.c
pata_rz1000.c
pata_samsung_cf.c
pata_sc1200.c
pata_scc.c
pata_sch.c
pata_serverworks.c
pata_sil680.c
pata_sis.c
pata_sl82c105.c
pata_triflex.c
pata_via.c
pdc_adma.c
sata_dwc_460ex.c
sata_fsl.c
sata_inic162x.c
sata_mv.c
sata_nv.c
sata_promise.c
sata_promise.h
sata_qstor.c
sata_sil.c
sata_sil24.c
sata_sis.c
sata_svw.c
sata_sx4.c
sata_uli.c
sata_via.c
sata_vsc.c
sis.h