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
..
2010-10-21 20:21:05 -04:00
2010-10-21 20:21:05 -04:00
2010-05-25 19:40:30 -04:00
2010-05-25 19:40:30 -04:00
2010-05-25 19:40:30 -04:00
2010-05-25 19:40:30 -04:00
2010-05-25 19:40:30 -04:00
2008-01-23 05:24:15 -05:00
2010-05-25 19:40:30 -04:00
2010-05-19 13:36:46 -04:00
2010-11-01 15:38:34 -04:00
2007-07-02 10:17:42 -04:00