libata: Fix use-after-iounmap
authorJeff Garzik <jgarzik@pobox.com>
Fri, 27 May 2005 01:54:27 +0000 (21:54 -0400)
committerJeff Garzik <jgarzik@pobox.com>
Fri, 27 May 2005 01:54:27 +0000 (21:54 -0400)
commitaa8f0dc6c3dbf1cf3ff58f3e945c981be134814d
tree3e343cd5493d442d1a26dc7a421422d84698831e
parentbef9c558841604116704e10b3d9ff3dbf4939423
libata: Fix use-after-iounmap

Jens Axboe pointed out that the iounmap() call in libata was occurring
too early, and some drivers (ahci, probably others) were using ioremap'd
memory after it had been unmapped.

The patch should address that problem by way of improving the libata
driver API:

* move ->host_stop() call after all ->port_stop() calls have occurred.

* create default helper function ata_host_stop(), and move iounmap()
call there.

* add ->host_stop_prewalk() hook, use it in sata_qstor.c (hi Mark).
sata_qstor appears to require the host-stop-before-port-stop ordering
that existed prior to applying the attached patch.
14 files changed:
drivers/scsi/ahci.c
drivers/scsi/ata_piix.c
drivers/scsi/libata-core.c
drivers/scsi/sata_nv.c
drivers/scsi/sata_promise.c
drivers/scsi/sata_qstor.c
drivers/scsi/sata_sil.c
drivers/scsi/sata_sis.c
drivers/scsi/sata_svw.c
drivers/scsi/sata_sx4.c
drivers/scsi/sata_uli.c
drivers/scsi/sata_via.c
drivers/scsi/sata_vsc.c
include/linux/libata.h