[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190822171833.201736423@linuxfoundation.org>
Date: Thu, 22 Aug 2019 10:18:44 -0700
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org,
syzbot <syzbot+62a1e04fd3ec2abf099e@...kaller.appspotmail.com>,
Andrey Konovalov <andreyknvl@...gle.com>,
Hillf Danton <hdanton@...a.com>, Jiri Kosina <jkosina@...e.cz>
Subject: [PATCH 4.4 40/78] HID: hiddev: do cleanup in failure of opening a device
From: Hillf Danton <hdanton@...a.com>
commit 6d4472d7bec39917b54e4e80245784ea5d60ce49 upstream.
Undo what we did for opening before releasing the memory slice.
Reported-by: syzbot <syzbot+62a1e04fd3ec2abf099e@...kaller.appspotmail.com>
Cc: Andrey Konovalov <andreyknvl@...gle.com>
Signed-off-by: Hillf Danton <hdanton@...a.com>
Signed-off-by: Jiri Kosina <jkosina@...e.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/hid/usbhid/hiddev.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -330,6 +330,10 @@ static int hiddev_open(struct inode *ino
return 0;
bail_unlock:
mutex_unlock(&hiddev->existancelock);
+
+ spin_lock_irq(&list->hiddev->list_lock);
+ list_del(&list->node);
+ spin_unlock_irq(&list->hiddev->list_lock);
bail:
file->private_data = NULL;
vfree(list);
Powered by blists - more mailing lists