From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/eeh: check handle_eeh_events() return value
Date: Fri, 13 Jul 2012 13:34:59 +1000 [thread overview]
Message-ID: <1342150499.15597.13.camel@pasglop> (raw)
In-Reply-To: <1342149276-18435-1-git-send-email-klebers@linux.vnet.ibm.com>
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);
prev parent reply other threads:[~2012-07-13 3:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1342150499.15597.13.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=klebers@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).