Commit 4f7c2874 authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik

libata: fix PMP initialization

Commit 842faa6c fixed error handling
during attach by not committing detected device class to dev->class
while attaching a new device.  However, this change missed the PMP
class check in the configuration loop causing a new PMP device to go
through ata_dev_configure() as if it were an ATA or ATAPI device.

As PMP device doesn't have a regular IDENTIFY data, this makes
ata_dev_configure() tries to configure a PMP device using an invalid
data.  For the most part, it wasn't too harmful and went unnoticed but
this ends up clearing dev->flags which may have ATA_DFLAG_AN set by
sata_pmp_attach().  This means that SATA_PMP_FEAT_NOTIFY ends up being
disabled on PMPs and on PMPs which honor the flag breaks hotplug
support.

This problem was discovered and reported by Ethan Hsiao.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Reported-by: default avatarEthan Hsiao <ethanhsiao@jmicron.com>
Cc: stable@kernel.org
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 6489e326
...@@ -2981,12 +2981,14 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link, ...@@ -2981,12 +2981,14 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
* device detection messages backwards. * device detection messages backwards.
*/ */
ata_for_each_dev(dev, link, ALL) { ata_for_each_dev(dev, link, ALL) {
if (!(new_mask & (1 << dev->devno)) || if (!(new_mask & (1 << dev->devno)))
dev->class == ATA_DEV_PMP)
continue; continue;
dev->class = ehc->classes[dev->devno]; dev->class = ehc->classes[dev->devno];
if (dev->class == ATA_DEV_PMP)
continue;
ehc->i.flags |= ATA_EHI_PRINTINFO; ehc->i.flags |= ATA_EHI_PRINTINFO;
rc = ata_dev_configure(dev); rc = ata_dev_configure(dev);
ehc->i.flags &= ~ATA_EHI_PRINTINFO; ehc->i.flags &= ~ATA_EHI_PRINTINFO;
......
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