mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-07 04:09:21 +00:00
[PATCH] cdev: cdev_put oops
While fixing an oops in the st driver in a dirty release path, I encountered an oops in cdev_put for cdevs allocated using cdev_alloc. If cdev_del is called when the cdev kobject still has an open user, when the last cdev_put is called, the cdev_put will call kobject_put, which will end up ultimately releasing the cdev in cdev_dynamic_release. Patch fixes the oops by preventing cdev_put from accessing freed memory. Signed-off-by: Brian King <brking@us.ibm.com> Cc: <viro@parcelfarce.linux.theplanet.co.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
50a5223428
commit
7da6844cf7
1 changed files with 2 additions and 1 deletions
|
@ -277,8 +277,9 @@ static struct kobject *cdev_get(struct cdev *p)
|
|||
void cdev_put(struct cdev *p)
|
||||
{
|
||||
if (p) {
|
||||
struct module *owner = p->owner;
|
||||
kobject_put(&p->kobj);
|
||||
module_put(p->owner);
|
||||
module_put(owner);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue