Commit 60817a68 authored by Aaron Lu's avatar Aaron Lu Committed by Jeff Garzik

libata-acpi: Fix NULL ptr derference in ata_acpi_dev_handle

commit 6b66d958 didn't handle SATA PMP
case in ata_acpi_bind_device and will cause a NULL ptr dereference when
user attached a SATA drive to the PMP port. Fix this by checking PMP
support.

This bug is reported by Dan van der Ster in the following bugzilla page:
https://bugzilla.kernel.org/show_bug.cgi?id=48211Reported-by: default avatarDan van der Ster <dan@vanderster.com>
Tested-by: default avatarDan van der Ster <dan@vanderster.com>
Signed-off-by: default avatarAaron Lu <aaron.lu@intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
Tested-by: default avatarSimon <tangouniform@sbcglobal.net>
parent c5e35d6c
......@@ -1105,10 +1105,15 @@ static int ata_acpi_bind_device(struct ata_port *ap, struct scsi_device *sdev,
struct acpi_device *acpi_dev;
struct acpi_device_power_state *states;
if (ap->flags & ATA_FLAG_ACPI_SATA)
ata_dev = &ap->link.device[sdev->channel];
else
if (ap->flags & ATA_FLAG_ACPI_SATA) {
if (!sata_pmp_attached(ap))
ata_dev = &ap->link.device[sdev->id];
else
ata_dev = &ap->pmp_link[sdev->channel].device[sdev->id];
}
else {
ata_dev = &ap->link.device[sdev->id];
}
*handle = ata_dev_acpi_handle(ata_dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment