Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1597994 > unrolled thread

[PATCH] Input: rmi4 - prevent null pointer dereference in f30

Started byBenjamin Tissoires <benjamin.tissoires@redhat.com>
First post2017-03-10 19:10 +0100
Last post2017-03-10 19:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] Input: rmi4 - prevent null pointer dereference in f30 Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2017-03-10 19:10 +0100
    Re: [PATCH] Input: rmi4 - prevent null pointer dereference in f30 Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-03-10 19:30 +0100

#1597994 — [PATCH] Input: rmi4 - prevent null pointer dereference in f30

FromBenjamin Tissoires <benjamin.tissoires@redhat.com>
Date2017-03-10 19:10 +0100
Subject[PATCH] Input: rmi4 - prevent null pointer dereference in f30
Message-ID<tjx9f-7F0-25@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1598011

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2017-03-10 19:30 +0100
Message-ID<tjxsC-7NS-29@gated-at.bofh.it>
In reply to#1597994
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web