Skip to content

Commit a2f6985

Browse files
Tomas Winklergregkh
authored andcommitted
mei: add mei_quirk_probe function
The main purpose of this function is to exclude ME devices without support for MEI/HECI interface from binding Currently affected systems are C600/X79 based servers that expose PCI device even though it doesn't supported ME Interface. MEI driver accessing such nonfunctional device can corrupt the system. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3e83095 commit a2f6985

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

‎drivers/misc/mei/main.c‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,27 @@ static struct miscdevice mei_misc_device = {
924924
.minor = MISC_DYNAMIC_MINOR,
925925
};
926926

927+
/**
928+
* mei_quirk_probe - probe for devices that doesn't valid ME interface
929+
* @pdev: PCI device structure
930+
* @ent: entry into pci_device_table
931+
*
932+
* returns true if ME Interface is valid, false otherwise
933+
*/
934+
static bool __devinit mei_quirk_probe(struct pci_dev *pdev,
935+
const struct pci_device_id *ent)
936+
{
937+
u32 reg;
938+
if (ent->device == MEI_DEV_ID_PBG_1) {
939+
pci_read_config_dword(pdev, 0x48, &reg);
940+
/* make sure that bit 9 is up and bit 10 is down */
941+
if ((reg & 0x600) == 0x200) {
942+
dev_info(&pdev->dev, "Device doesn't have valid ME Interface\n");
943+
return false;
944+
}
945+
}
946+
return true;
947+
}
927948
/**
928949
* mei_probe - Device Initialization Routine
929950
*
@@ -939,6 +960,12 @@ static int __devinit mei_probe(struct pci_dev *pdev,
939960
int err;
940961

941962
mutex_lock(&mei_mutex);
963+
964+
if (!mei_quirk_probe(pdev, ent)) {
965+
err = -ENODEV;
966+
goto end;
967+
}
968+
942969
if (mei_device) {
943970
err = -EEXIST;
944971
goto end;

0 commit comments

Comments
 (0)