Commit-ID:  83f8ebd2eb459b21e8e74d43c75e1be666ec8b97
Gitweb:     http://git.kernel.org/tip/83f8ebd2eb459b21e8e74d43c75e1be666ec8b97
Author:     Thomas Gleixner <[email protected]>
AuthorDate: Mon, 22 Feb 2016 22:19:10 +0000
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 29 Feb 2016 09:35:14 +0100

perf/x86/intel/uncore: Add sanity checks for PCI dev package id

The storage array is size limited, but misses a sanity check

Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Harish Chegondi <[email protected]>
Cc: Jacob Pan <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Vince Weaver <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
 arch/x86/events/intel/uncore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index 25e6203..42ea435 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -882,7 +882,7 @@ static int uncore_pci_probe(struct pci_dev *pdev, const 
struct pci_device_id *id
        int phys_id, ret;
 
        phys_id = uncore_pcibus_to_physid(pdev->bus);
-       if (phys_id < 0)
+       if (phys_id < 0 || phys_id >= UNCORE_SOCKET_MAX)
                return -ENODEV;
 
        if (UNCORE_PCI_DEV_TYPE(id->driver_data) == UNCORE_EXTRA_PCI_DEV) {

Reply via email to