Thread (4 messages) 4 messages, 2 authors, 2019-11-25

Re: [PATCH] HID: hid-lg4ff: Fix uninit-value set_autocenter_default

From: Benjamin Tissoires <hidden>
Date: 2019-11-18 09:43:41
Also in: linux-kernel-mentees, lkml

On Tue, Nov 5, 2019 at 3:18 PM Phong Tran [off-list ref] wrote:
syzbot found a problem using of uinit pointer in
lg4ff_set_autocenter_default().

Reported-by: syzbot+1234691fec1b8ceba8b1@syzkaller.appspotmail.com

Tested by syzbot:

https://groups.google.com/d/msg/syzkaller-bugs/ApnMLW6sfKE/Qq0bIHGEAQAJ
This seems weird to me:

the syzbot link above is about `hid_get_drvdata(hid)`, and, as I read
it, the possibility that hid might not have an initialized value.

Here you are changing the initialized values of value, entry and
drv_data, all 3 are never used before their first assignment.

I have a feeling this particular syzbot check has already been fixed
upstream by d9d4b1e46d95 "HID: Fix assumption that devices have
inputs".

Cheers,
Benjamin
quoted hunk ↗ jump to hunk
Signed-off-by: Phong Tran <redacted>
---
 drivers/hid/hid-lg4ff.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index 5e6a0cef2a06..44dfd08b0c32 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -468,10 +468,10 @@ static int lg4ff_play(struct input_dev *dev, void *data, struct ff_effect *effec
 static void lg4ff_set_autocenter_default(struct input_dev *dev, u16 magnitude)
 {
        struct hid_device *hid = input_get_drvdata(dev);
-       s32 *value;
+       s32 *value = NULL;
        u32 expand_a, expand_b;
-       struct lg4ff_device_entry *entry;
-       struct lg_drv_data *drv_data;
+       struct lg4ff_device_entry *entry = NULL;
+       struct lg_drv_data *drv_data = NULL;
        unsigned long flags;

        drv_data = hid_get_drvdata(hid);
--
2.20.1
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help