* [PATCH] Input: rmi4 - prevent null pointer dereference in f30
@ 2017-03-10 18:05 Benjamin Tissoires
2017-03-10 18:23 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Tissoires @ 2017-03-10 18:05 UTC (permalink / raw)
To: Dmitry Torokhov, Andrew Duggan; +Cc: linux-kernel, linux-input
If the platform data has f30_data.disable set, f30 in rmi_f30_config()
might be null. Prevent a kernel oops by checking for non-null f30.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
drivers/input/rmi4/rmi_f30.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/input/rmi4/rmi_f30.c b/drivers/input/rmi4/rmi_f30.c
index d8ff285..a0e4030 100644
--- a/drivers/input/rmi4/rmi_f30.c
+++ b/drivers/input/rmi4/rmi_f30.c
@@ -170,6 +170,10 @@ static int rmi_f30_config(struct rmi_function *fn)
rmi_get_platform_data(fn->rmi_dev);
int error;
+ /* can happen if f30_data.disable is set */
+ if (!f30)
+ return 0;
+
if (pdata->f30_data.trackstick_buttons) {
/* Try [re-]establish link to F03. */
f30->f03 = rmi_find_function(fn->rmi_dev, 0x03);
--
2.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Input: rmi4 - prevent null pointer dereference in f30
2017-03-10 18:05 [PATCH] Input: rmi4 - prevent null pointer dereference in f30 Benjamin Tissoires
@ 2017-03-10 18:23 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2017-03-10 18:23 UTC (permalink / raw)
To: Benjamin Tissoires; +Cc: Andrew Duggan, linux-kernel, linux-input
On Fri, Mar 10, 2017 at 07:05:52PM +0100, Benjamin Tissoires wrote:
> If the platform data has f30_data.disable set, f30 in rmi_f30_config()
> might be null. Prevent a kernel oops by checking for non-null f30.
>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Applied, thank you.
> ---
> drivers/input/rmi4/rmi_f30.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/input/rmi4/rmi_f30.c b/drivers/input/rmi4/rmi_f30.c
> index d8ff285..a0e4030 100644
> --- a/drivers/input/rmi4/rmi_f30.c
> +++ b/drivers/input/rmi4/rmi_f30.c
> @@ -170,6 +170,10 @@ static int rmi_f30_config(struct rmi_function *fn)
> rmi_get_platform_data(fn->rmi_dev);
> int error;
>
> + /* can happen if f30_data.disable is set */
> + if (!f30)
> + return 0;
> +
> if (pdata->f30_data.trackstick_buttons) {
> /* Try [re-]establish link to F03. */
> f30->f03 = rmi_find_function(fn->rmi_dev, 0x03);
> --
> 2.9.3
>
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-10 18:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-10 18:05 [PATCH] Input: rmi4 - prevent null pointer dereference in f30 Benjamin Tissoires
2017-03-10 18:23 ` Dmitry Torokhov
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).