[PATCH] cdev: cdev_put oops
authorBrian King <brking@us.ibm.com>
Tue, 12 Jul 2005 20:58:30 +0000 (13:58 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 12 Jul 2005 23:01:02 +0000 (16:01 -0700)
commit7da6844cf7bc44dcda548a0a0aebf85f3a1c1485
tree9105032fd6803f2e0d6a24a483145f39ef5fdecd
parent50a5223428bbe77bc0f312100c950b6f4520ba34
[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>
fs/char_dev.c