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>
This commit is contained in:
Dan Carpenter 2011-05-26 11:49:16 +03:00 committed by Jiri Kosina
parent e23be0a27d
commit 5c699d7d3f
1 changed files with 4 additions and 1 deletions

View File

@ -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;
}