diff options
author | Dan Carpenter <error27@gmail.com> | 2011-05-26 04:49:16 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-05-26 08:04:40 -0400 |
commit | 5c699d7d3f94ee1dd934edea889b32f8279a4e65 (patch) | |
tree | d46ed26c576ce7357c3d1efe0b63d6779687927f /drivers/hid/usbhid | |
parent | e23be0a27dcc9297ff0495360d89bc5b0bf12383 (diff) |
HID: hiddev: fix use after free in hiddev_release
There are a couple use after free bugs here.
Signed-off-by: Dan Carpenter <error27@gmail.com>
[jkosina@suse.cz: removed already fixed hunk]
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/usbhid')
-rw-r--r-- | drivers/hid/usbhid/hiddev.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 4985f485932f..7c1188b53c3e 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
@@ -248,12 +248,15 @@ static int hiddev_release(struct inode * inode, struct file * file) | |||
248 | usbhid_close(list->hiddev->hid); | 248 | usbhid_close(list->hiddev->hid); |
249 | usbhid_put_power(list->hiddev->hid); | 249 | usbhid_put_power(list->hiddev->hid); |
250 | } else { | 250 | } else { |
251 | mutex_unlock(&list->hiddev->existancelock); | ||
251 | kfree(list->hiddev); | 252 | kfree(list->hiddev); |
253 | kfree(list); | ||
254 | return 0; | ||
252 | } | 255 | } |
253 | } | 256 | } |
254 | 257 | ||
255 | kfree(list); | ||
256 | mutex_unlock(&list->hiddev->existancelock); | 258 | mutex_unlock(&list->hiddev->existancelock); |
259 | kfree(list); | ||
257 | 260 | ||
258 | return 0; | 261 | return 0; |
259 | } | 262 | } |