[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190814021548.16001-49-sashal@kernel.org>
Date: Tue, 13 Aug 2019 22:15:27 -0400
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Hillf Danton <hdanton@...a.com>,
syzbot <syzbot+62a1e04fd3ec2abf099e@...kaller.appspotmail.com>,
Andrey Konovalov <andreyknvl@...gle.com>,
Jiri Kosina <jkosina@...e.cz>, Sasha Levin <sashal@...nel.org>,
linux-usb@...r.kernel.org, linux-input@...r.kernel.org
Subject: [PATCH AUTOSEL 4.19 49/68] HID: hiddev: do cleanup in failure of opening a device
From: Hillf Danton <hdanton@...a.com>
[ Upstream commit 6d4472d7bec39917b54e4e80245784ea5d60ce49 ]
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: Sasha Levin <sashal@...nel.org>
---
drivers/hid/usbhid/hiddev.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 56da33bc3862e..5a949ca42b1d0 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -321,6 +321,10 @@ static int hiddev_open(struct inode *inode, struct file *file)
hid_hw_power(hid, PM_HINT_NORMAL);
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);
--
2.20.1
Powered by blists - more mailing lists