Files
linux/drivers/ata
Tejun Heo 162231ba4b libata: set queue DMA alignment to sector size for ATAPI too
commit 729a6a300e upstream.

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>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-05-09 15:55:41 -07:00
..
2009-10-06 00:26:27 -04:00
2009-10-06 00:26:27 -04:00
2009-03-24 22:45:05 -04:00
2009-08-12 06:16:47 -04:00
2009-06-05 14:40:52 -04:00
2009-03-28 20:29:51 +00:00
2009-06-08 09:12:28 -07:00
2009-07-28 21:05:18 -04:00
2009-09-11 02:25:58 -04:00
2009-09-11 02:25:58 -04:00
2009-09-11 02:33:59 -04:00
2009-10-16 06:22:40 -04:00
2010-04-26 07:41:21 -07:00
2009-11-19 18:18:17 -05:00
2009-09-17 16:46:34 -04:00
2008-01-23 05:24:15 -05:00
2009-09-08 21:17:36 -04:00
2007-07-02 10:17:42 -04:00