From: Radu Rendec <radu.rendec@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Radu Rendec <radu.rendec@gmail.com>, Paul Mackerras <paulus@samba.org>
Subject: [PATCH 0/1] Fix NULL pointer access in PowerPC MSI teardown code
Date: Tue, 27 Nov 2018 22:20:47 -0500 [thread overview]
Message-ID: <20181128032048.11665-1-radu.rendec@gmail.com> (raw)
Hi everyone,
It seems there's an unchecked access to a NULL pointer (to a function)
in the PowerPC MSI teardown code. I found this on kernel 4.9, but the
code looks identical in the latest 4.20-rc. I don't see any reason why
this wouldn't happen on recent kernels too.
The PowerPC architecture specific MSI setup and teardown functions are
in arch/powerpc/kernel/msi.c:
* arch_setup_msi_irqs() checks pointers for both the setup_msi_irqs
and teardown_msi_irqs ops and returns -ENOSYS if either one is NULL.
* arch_teardown_msi_irqs() calls on the teardown_msi_irqs op pointer
without checking it and assumes the function is never called unless
arch_setup_msi_irqs() returns successfully.
The assumption in arch_teardown_msi_irqs() is wrong and results in a
function call on a NULL pointer. An example of how this can happen is
included in the actual patch header. In my case, it happens when the PCI
hardware is configured during kernel start-up, because my controller
doesn't support MSI and the ops are NULL.
I'm proposing the attached patch to fix the problem. It basically just
checks the pointer before the function call.
The patch is against v4.20-rc4, but I only actually tested it on
v4.9.115. On the other hand, the patch is trivial and I did check that
the NULL pointer dereference scenario is still valid on v4.20-rc4.
Best regards,
Radu Rendec
Radu Rendec (1):
Fix NULL pointer access in PowerPC MSI teardown code
arch/powerpc/kernel/msi.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
--
2.17.2
next reply other threads:[~2018-11-28 3:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-28 3:20 Radu Rendec [this message]
2018-11-28 3:20 ` [PATCH 1/1] Fix NULL pointer access in PowerPC MSI teardown code Radu Rendec
2018-12-02 11:02 ` [1/1] " Michael Ellerman
2018-11-28 11:00 ` [PATCH 0/1] " Michael Ellerman
2018-11-28 15:15 ` Radu Rendec
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=20181128032048.11665-1-radu.rendec@gmail.com \
--to=radu.rendec@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.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).