commit: 10db8d212864cb6741df7d7fafda5ab6661f6f88
From: Kleber Sacilotto de Souza <[email protected]>
Date: Thu, 12 Jul 2012 17:14:36 +0000
Subject: powerpc/eeh: Check handle_eeh_events() return value

Function eeh_event_handler() dereferences the pointer returned by
handle_eeh_events() without checking, causing a crash if NULL was
returned, which is expected in some situations.

This patch fixes this bug by checking for the value returned by
handle_eeh_events() before dereferencing it.

Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
Signed-off-by: Benjamin Herrenschmidt <[email protected]>
CC: [email protected] [v3.4+]
---
 arch/powerpc/platforms/pseries/eeh_event.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/eeh_event.c 
b/arch/powerpc/platforms/pseries/eeh_event.c
index 4cb375c..fb50631 100644
--- a/arch/powerpc/platforms/pseries/eeh_event.c
+++ b/arch/powerpc/platforms/pseries/eeh_event.c
@@ -85,8 +85,10 @@ static int eeh_event_handler(void * dummy)
        set_current_state(TASK_INTERRUPTIBLE);  /* Don't add to load average */
        edev = handle_eeh_events(event);
 
-       eeh_clear_slot(eeh_dev_to_of_node(edev), EEH_MODE_RECOVERING);
-       pci_dev_put(edev->pdev);
+       if (edev) {
+               eeh_clear_slot(eeh_dev_to_of_node(edev), EEH_MODE_RECOVERING);
+               pci_dev_put(edev->pdev);
+       }
 
        kfree(event);
        mutex_unlock(&eeh_event_mutex);
-- 
1.7.3.4
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to