watchdog: core: fix null pointer dereference when releasing cdev
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Tue, 28 Aug 2018 10:13:47 +0000 (12:13 +0200)
committerWim Van Sebroeck <wim@linux-watchdog.org>
Tue, 2 Oct 2018 11:32:24 +0000 (13:32 +0200)
commit953b9dd7725bad55a922a35e75bff7bebf7b9978
tree21362448aa15c3147f1cb97e5a07863632602e5b
parent3bed02a2966146b5876b366f4489e30af0547c66
watchdog: core: fix null pointer dereference when releasing cdev

watchdog_stop() calls watchdog_update_worker() which needs a valid
wdd->wd_data pointer. So, when unregistering the cdev, clear the
pointers after we call watchdog_stop(), not before.

Fixes: bb292ac1c602 ("watchdog: Introduce watchdog_stop_on_unregister helper")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
drivers/watchdog/watchdog_dev.c