Skip to content

Commit

Permalink
watchdog: mei: avoid oops in watchdog unregister code path
Browse files Browse the repository at this point in the history
With commit c7d3df3 "mei: use internal watchdog device registration
tracking" will crash the kernel on shutdown path on systems
where ME watchdog is not present.
Since the watchdog was never initialized in such case
the WDOG_UNREGISTERED bit is never set and the system
crashes on access to uninitialized variables down the path.

To solve the issue we query for NULL on watchdog driver driver_data
to check whether the device is registered. This is handled in the
driver and doesn't depend on watchdog core internals.

Cc: Borislav Petkov <bp@alien8.de>
Cc: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Jerry Snitselaar <jerry.snitselaar@oracle.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
  • Loading branch information
Tomas Winkler authored and Wim Van Sebroeck committed Dec 19, 2012
1 parent 8c4c419 commit d692170
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/misc/mei/wd.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ void mei_watchdog_register(struct mei_device *dev)

void mei_watchdog_unregister(struct mei_device *dev)
{
if (test_bit(WDOG_UNREGISTERED, &amt_wd_dev.status))
if (watchdog_get_drvdata(&amt_wd_dev) == NULL)
return;

watchdog_set_drvdata(&amt_wd_dev, NULL);
Expand Down

0 comments on commit d692170

Please sign in to comment.