From: Corey Minyard <minyard@acm.org>
To: Andrew Banman <abanman@hpe.com>
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 14:00:44 -0600 [thread overview]
Message-ID: <09f6a9da-5bee-4a78-9d0f-5ac8336bd394@acm.org> (raw)
In-Reply-To: <bf0b9527-7195-513b-6b10-3e146d0f90af@hpe.com>
On 11/08/2017 11:11 AM, Andrew Banman wrote:
> 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?
>
This begs the question: How did you produce this? From what I can tell,
there is no way you can get to this code if you don't have a working and
initialized smi_info structure, and that's not the only place this would
have to be fixed if it wasn't. So it's not what you assume, I don't think
it's an uninitialized smi_info structure on the list.
As usual with these sorts of things, please send tracebacks and reproduction
procedures.
If you are removing the module and this happens, there may be a race
conditions, but this is the wrong fix. More likely that the structure gets
cleaned up and this function is called afterwards.
-corey
> 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;
>> }
>
next prev parent reply other threads:[~2017-11-08 20:00 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
2017-11-08 20:00 ` Corey Minyard [this message]
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=09f6a9da-5bee-4a78-9d0f-5ac8336bd394@acm.org \
--to=minyard@acm.org \
--cc=abanman@hpe.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.travis@hpe.com \
--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®