Skip to content

Commit

Permalink
HID: hiddev: fix use after free in hiddev_release
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Jiri Kosina committed May 26, 2011
1 parent e23be0a commit 5c699d7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/hid/usbhid/hiddev.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,15 @@ static int hiddev_release(struct inode * inode, struct file * file)
usbhid_close(list->hiddev->hid);
usbhid_put_power(list->hiddev->hid);
} else {
mutex_unlock(&list->hiddev->existancelock);
kfree(list->hiddev);
kfree(list);
return 0;
}
}

kfree(list);
mutex_unlock(&list->hiddev->existancelock);
kfree(list);

return 0;
}
Expand Down

0 comments on commit 5c699d7

Please sign in to comment.