From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: linux-kernel@vger.kernel.org
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Miloslav Trmac <mitr@volny.cz>, Wolfram Sang <wsa@the-dreams.de>,
linux-input@vger.kernel.org, Hulk Robot <hulkci@huawei.com>
Subject: [PATCH 2/3] Input: wistron_btns: avoid panic if ioreamp fails
Date: Fri, 10 May 2019 11:03:19 +0800 [thread overview]
Message-ID: <20190510030320.109154-2-wangkefeng.wang@huawei.com> (raw)
In-Reply-To: <20190510030320.109154-1-wangkefeng.wang@huawei.com>
If ioremap fails, NULL pointer dereference will happen and
leading to a kernel panic when access the virtual address
in check_signature().
Fix it by check the return value of ioremap.
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Miloslav Trmac <mitr@volny.cz>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-input@vger.kernel.org
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
drivers/input/misc/wistron_btns.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index 43e67f546366..a82ec3d102b4 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -107,7 +107,10 @@ static int __init map_bios(void)
ssize_t offset;
u32 entry_point;
- base = ioremap(0xF0000, 0x10000); /* Can't fail */
+ base = ioremap(0xF0000, 0x10000);
+ if (!base)
+ return -ENOMEM;
+
offset = locate_wistron_bios(base);
if (offset < 0) {
printk(KERN_ERR "wistron_btns: BIOS entry point not found\n");
--
2.20.1
prev parent reply other threads:[~2019-05-10 3:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-10 3:03 [PATCH 1/3] Input: apanel: avoid panic if ioreamp fails Kefeng Wang
2019-05-10 3:03 ` Kefeng Wang [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=20190510030320.109154-2-wangkefeng.wang@huawei.com \
--to=wangkefeng.wang@huawei.com \
--cc=dmitry.torokhov@gmail.com \
--cc=hulkci@huawei.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mitr@volny.cz \
--cc=wsa@the-dreams.de \
/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).