mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Banman <abanman@hpe.com>
To: Corey Minyard <minyard@acm.org>
Cc: Dimitri Sivanich <sivanich@hpe.com>,
	"Anderson, Russ" <russ.anderson@hpe.com>,
	Mike Travis <mike.travis@hpe.com>,
	<openipmi-developer@lists.sourceforge.net>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drivers/char/ipmi_si: prevent null deref during module exit
Date: Wed, 8 Nov 2017 11:11:10 -0600	[thread overview]
Message-ID: <bf0b9527-7195-513b-6b10-3e146d0f90af@hpe.com> (raw)
In-Reply-To: <988aec06-2127-3120-47a4-5d0131f59a61@hpe.com>

On 11/8/17 11:06 AM, Andrew Banman wrote:
> If there are uninitialized SMIs in the smi_infos list, i.e. with no
> handlers set, then disable_si_irq() in cleanup_smi_one() will hit a null
> pointer dereference when the former attempts to start the check enables
> transaction. Thus, we panic during module exit.

I think this points to a broader problem of holding uninitialized smi_info
structs in smi_infos list. There are many places where handlers and other struct
members are assumed. Maybe a better design would be to remove SMIs from the list
if we have no intention of initializing them?

Andrew

> 
> Avoid panicking when there are uninitialized SMIs by checking for a handler
> pointer before starting the check enables transaction.
> 
> Signed-off-by: Andrew Banman <abanman@hpe.com>
> ---
>   drivers/char/ipmi/ipmi_si_intf.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
> index cb5719e..6c0b1b3 100644
> --- a/drivers/char/ipmi/ipmi_si_intf.c
> +++ b/drivers/char/ipmi/ipmi_si_intf.c
> @@ -442,7 +442,7 @@ static void start_check_enables(struct smi_info *smi_info, 
> bool start_timer)
> 
>       if (start_timer)
>           start_new_msg(smi_info, msg, 2);
> -    else
> +    else if (smi_info->handlers)
>           smi_info->handlers->start_transaction(smi_info->si_sm, msg, 2);
>       smi_info->si_state = SI_CHECKING_ENABLES;
>   }

  reply	other threads:[~2017-11-08 17:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-08 17:06 Andrew Banman
2017-11-08 17:11 ` Andrew Banman [this message]
2017-11-08 20:00   ` Corey Minyard
2017-11-09 18:02     ` Andrew Banman
2017-11-09 18:38       ` Corey Minyard
2017-11-09 18:54         ` Corey Minyard
2017-11-09 19:48           ` [PATCH] ipmi: Prefer ACPI system interfaces over SMBIOS ones minyard
2017-11-09 21:50             ` Andrew Banman

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=bf0b9527-7195-513b-6b10-3e146d0f90af@hpe.com \
    --to=abanman@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.travis@hpe.com \
    --cc=minyard@acm.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    --cc=russ.anderson@hpe.com \
    --cc=sivanich@hpe.com \
    /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

all inboxes | Powered by JetHome®