linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: fix defuzzing logic
@ 2014-07-19 23:49 Dmitry Torokhov
  2014-07-20  9:50 ` David Herrmann
  2014-07-20 18:19 ` Henrik Rydberg
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2014-07-19 23:49 UTC (permalink / raw)
  To: linux-input
  Cc: Benson Leung, David Herrmann, Andrew de los Reyes, Henrik Rydberg,
	linux-kernel

We attempt to remove noise from coordinates reported by devices in
input_handle_abs_event(), unfortunately, unless we were dropping the
event altogether, we were ignoring the adjusted value and were passing
on the original value instead.

Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/input.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 1c4c0db..29ca0bb 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -257,9 +257,10 @@ static int input_handle_abs_event(struct input_dev *dev,
 }
 
 static int input_get_disposition(struct input_dev *dev,
-			  unsigned int type, unsigned int code, int value)
+			  unsigned int type, unsigned int code, int *pval)
 {
 	int disposition = INPUT_IGNORE_EVENT;
+	int value = *pval;
 
 	switch (type) {
 
@@ -357,6 +358,7 @@ static int input_get_disposition(struct input_dev *dev,
 		break;
 	}
 
+	*pval = value;
 	return disposition;
 }
 
@@ -365,7 +367,7 @@ static void input_handle_event(struct input_dev *dev,
 {
 	int disposition;
 
-	disposition = input_get_disposition(dev, type, code, value);
+	disposition = input_get_disposition(dev, type, code, &value);
 
 	if ((disposition & INPUT_PASS_TO_DEVICE) && dev->event)
 		dev->event(dev, type, code, value);

-- 
Dmitry

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Input: fix defuzzing logic
  2014-07-19 23:49 [PATCH] Input: fix defuzzing logic Dmitry Torokhov
@ 2014-07-20  9:50 ` David Herrmann
  2014-07-20 18:19 ` Henrik Rydberg
  1 sibling, 0 replies; 3+ messages in thread
From: David Herrmann @ 2014-07-20  9:50 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: open list:HID CORE LAYER, Benson Leung, Andrew de los Reyes,
	Henrik Rydberg, linux-kernel

Hi

On Sun, Jul 20, 2014 at 1:49 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> We attempt to remove noise from coordinates reported by devices in
> input_handle_abs_event(), unfortunately, unless we were dropping the
> event altogether, we were ignoring the adjusted value and were passing
> on the original value instead.

Reviewed-by: David Herrmann <dh.herrmann@gmail.com>

Thanks
David

> Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
> Reviewed-by: Benson Leung <bleung@chromium.org>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/input/input.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index 1c4c0db..29ca0bb 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -257,9 +257,10 @@ static int input_handle_abs_event(struct input_dev *dev,
>  }
>
>  static int input_get_disposition(struct input_dev *dev,
> -                         unsigned int type, unsigned int code, int value)
> +                         unsigned int type, unsigned int code, int *pval)
>  {
>         int disposition = INPUT_IGNORE_EVENT;
> +       int value = *pval;
>
>         switch (type) {
>
> @@ -357,6 +358,7 @@ static int input_get_disposition(struct input_dev *dev,
>                 break;
>         }
>
> +       *pval = value;
>         return disposition;
>  }
>
> @@ -365,7 +367,7 @@ static void input_handle_event(struct input_dev *dev,
>  {
>         int disposition;
>
> -       disposition = input_get_disposition(dev, type, code, value);
> +       disposition = input_get_disposition(dev, type, code, &value);
>
>         if ((disposition & INPUT_PASS_TO_DEVICE) && dev->event)
>                 dev->event(dev, type, code, value);
>
> --
> Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Input: fix defuzzing logic
  2014-07-19 23:49 [PATCH] Input: fix defuzzing logic Dmitry Torokhov
  2014-07-20  9:50 ` David Herrmann
@ 2014-07-20 18:19 ` Henrik Rydberg
  1 sibling, 0 replies; 3+ messages in thread
From: Henrik Rydberg @ 2014-07-20 18:19 UTC (permalink / raw)
  To: Dmitry Torokhov, linux-input
  Cc: Benson Leung, David Herrmann, Andrew de los Reyes, linux-kernel

Hi Dmitry,

> We attempt to remove noise from coordinates reported by devices in
> input_handle_abs_event(), unfortunately, unless we were dropping the
> event altogether, we were ignoring the adjusted value and were passing
> on the original value instead.
> 
> Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
> Reviewed-by: Benson Leung <bleung@chromium.org>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/input/input.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Oh my, that was a bad one.

Reviewed-by: Henrik Rydberg <rydberg@euromail.se>

Thanks,
Henrik

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-20 18:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-19 23:49 [PATCH] Input: fix defuzzing logic Dmitry Torokhov
2014-07-20  9:50 ` David Herrmann
2014-07-20 18:19 ` Henrik Rydberg

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).