From: Max Kellermann Date: Mon, 21 Mar 2016 11:33:05 +0000 (-0300) Subject: [media] drivers/media/rc: postpone kfree(rc_dev) X-Git-Tag: microblaze-4.10-rc1~812^2~22 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=47cae1e1cfdb6a07ca19c61345c4d96f828b14d7;p=linux-2.6-microblaze.git [media] drivers/media/rc: postpone kfree(rc_dev) CONFIG_DEBUG_KOBJECT_RELEASE found this bug. Signed-off-by: Max Kellermann Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 68541b1e3bcb..7dfc7c2188f0 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -1263,6 +1263,9 @@ unlock: static void rc_dev_release(struct device *device) { + struct rc_dev *dev = to_rc_dev(device); + + kfree(dev); } #define ADD_HOTPLUG_VAR(fmt, val...) \ @@ -1384,7 +1387,9 @@ void rc_free_device(struct rc_dev *dev) put_device(&dev->dev); - kfree(dev); + /* kfree(dev) will be called by the callback function + rc_dev_release() */ + module_put(THIS_MODULE); } EXPORT_SYMBOL_GPL(rc_free_device);