Revision 729a6a300e628a48cf12bac93a964a535e83cd1d authored by Tejun Heo on 20 January 2011, 12:59:06 UTC, committed by Jeff Garzik on 28 January 2011, 08:16:20 UTC
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>
1 parent 4a5610a
History
File Mode Size
Kconfig -rw-r--r-- 4.1 KB
Makefile -rw-r--r-- 253 bytes
cache.c -rw-r--r-- 8.4 KB
dir.c -rw-r--r-- 33.7 KB
fat.h -rw-r--r-- 11.6 KB
fatent.c -rw-r--r-- 16.3 KB
file.c -rw-r--r-- 10.8 KB
inode.c -rw-r--r-- 41.6 KB
misc.c -rw-r--r-- 7.1 KB
namei_msdos.c -rw-r--r-- 16.8 KB
namei_vfat.c -rw-r--r-- 25.8 KB

back to top