* [PATCH] powerpc/eeh: check handle_eeh_events() return value
@ 2012-07-13 3:14 Kleber Sacilotto de Souza
2012-07-13 3:34 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 2+ messages in thread
From: Kleber Sacilotto de Souza @ 2012-07-13 3:14 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Kleber Sacilotto de Souza
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 <klebers@linux.vnet.ibm.com>
---
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.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] powerpc/eeh: check handle_eeh_events() return value
2012-07-13 3:14 [PATCH] powerpc/eeh: check handle_eeh_events() return value Kleber Sacilotto de Souza
@ 2012-07-13 3:34 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2012-07-13 3:34 UTC (permalink / raw)
To: Kleber Sacilotto de Souza; +Cc: linuxppc-dev
On Fri, 2012-07-13 at 00:14 -0300, Kleber Sacilotto de Souza wrote:
> 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.
Thanks,
Ben.
> Signed-off-by: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>
> ---
> 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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-07-13 3:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-13 3:14 [PATCH] powerpc/eeh: check handle_eeh_events() return value Kleber Sacilotto de Souza
2012-07-13 3:34 ` Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).