All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Input: synaptics - avoid using uninitialized variable when probing
@ 2018-10-17  0:14 Dmitry Torokhov
  2018-10-17  7:03 ` Benjamin Tissoires
  2018-10-19  5:46 ` Peter Hutterer
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2018-10-17  0:14 UTC (permalink / raw)
  To: linux-input; +Cc: Benjamin Tissoires, linux-kernel

synaptics_detect() does not check whether sending commands to the
device succeeds and instead relies on getting unique data from the
device. Let's make sure we seed entire buffer with zeroes to make sure
we not use garbage on stack that just happen to be 0x47.

Reported-by: syzbot+13cb3b01d0784e4ffc3f@syzkaller.appspotmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/mouse/synaptics.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 55d33500d55e..5e85f3cca867 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -99,9 +99,7 @@ static int synaptics_mode_cmd(struct psmouse *psmouse, u8 mode)
 int synaptics_detect(struct psmouse *psmouse, bool set_properties)
 {
 	struct ps2dev *ps2dev = &psmouse->ps2dev;
-	u8 param[4];
-
-	param[0] = 0;
+	u8 param[4] = { 0 };
 
 	ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
 	ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
-- 
2.19.1.331.ge82ca0e54c-goog


-- 
Dmitry

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

* Re: [PATCH] Input: synaptics - avoid using uninitialized variable when probing
  2018-10-17  0:14 [PATCH] Input: synaptics - avoid using uninitialized variable when probing Dmitry Torokhov
@ 2018-10-17  7:03 ` Benjamin Tissoires
  2018-10-19  5:46 ` Peter Hutterer
  1 sibling, 0 replies; 3+ messages in thread
From: Benjamin Tissoires @ 2018-10-17  7:03 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: open list:HID CORE LAYER, lkml

On Wed, Oct 17, 2018 at 2:14 AM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
>
> synaptics_detect() does not check whether sending commands to the
> device succeeds and instead relies on getting unique data from the
> device. Let's make sure we seed entire buffer with zeroes to make sure
> we not use garbage on stack that just happen to be 0x47.
>
> Reported-by: syzbot+13cb3b01d0784e4ffc3f@syzkaller.appspotmail.com
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---

Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

>  drivers/input/mouse/synaptics.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> index 55d33500d55e..5e85f3cca867 100644
> --- a/drivers/input/mouse/synaptics.c
> +++ b/drivers/input/mouse/synaptics.c
> @@ -99,9 +99,7 @@ static int synaptics_mode_cmd(struct psmouse *psmouse, u8 mode)
>  int synaptics_detect(struct psmouse *psmouse, bool set_properties)
>  {
>         struct ps2dev *ps2dev = &psmouse->ps2dev;
> -       u8 param[4];
> -
> -       param[0] = 0;
> +       u8 param[4] = { 0 };
>
>         ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
>         ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
> --
> 2.19.1.331.ge82ca0e54c-goog
>
>
> --
> Dmitry

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

* Re: [PATCH] Input: synaptics - avoid using uninitialized variable when probing
  2018-10-17  0:14 [PATCH] Input: synaptics - avoid using uninitialized variable when probing Dmitry Torokhov
  2018-10-17  7:03 ` Benjamin Tissoires
@ 2018-10-19  5:46 ` Peter Hutterer
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Hutterer @ 2018-10-19  5:46 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, Benjamin Tissoires, linux-kernel

On Tue, Oct 16, 2018 at 05:14:43PM -0700, Dmitry Torokhov wrote:
> synaptics_detect() does not check whether sending commands to the
> device succeeds and instead relies on getting unique data from the
> device. Let's make sure we seed entire buffer with zeroes to make sure
> we not use garbage on stack that just happen to be 0x47.
> 
> Reported-by: syzbot+13cb3b01d0784e4ffc3f@syzkaller.appspotmail.com
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

doh, was just about to send out the same patch.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>

Cheers,
   Peter

> ---
>  drivers/input/mouse/synaptics.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> index 55d33500d55e..5e85f3cca867 100644
> --- a/drivers/input/mouse/synaptics.c
> +++ b/drivers/input/mouse/synaptics.c
> @@ -99,9 +99,7 @@ static int synaptics_mode_cmd(struct psmouse *psmouse, u8 mode)
>  int synaptics_detect(struct psmouse *psmouse, bool set_properties)
>  {
>  	struct ps2dev *ps2dev = &psmouse->ps2dev;
> -	u8 param[4];
> -
> -	param[0] = 0;
> +	u8 param[4] = { 0 };
>  
>  	ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
>  	ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
> -- 
> 2.19.1.331.ge82ca0e54c-goog
> 
> 
> -- 
> Dmitry

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

end of thread, other threads:[~2018-10-19  5:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-17  0:14 [PATCH] Input: synaptics - avoid using uninitialized variable when probing Dmitry Torokhov
2018-10-17  7:03 ` Benjamin Tissoires
2018-10-19  5:46 ` Peter Hutterer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.