]> git.baikalelectronics.ru Git - kernel.git/commit
watchdog: imgpdc: Fix probe NULL pointer dereference
authorJames Hogan <james.hogan@imgtec.com>
Fri, 20 Feb 2015 23:45:44 +0000 (23:45 +0000)
committerWim Van Sebroeck <wim@iguana.be>
Fri, 27 Mar 2015 07:47:42 +0000 (08:47 +0100)
commit51b583bf18b898cc2a034e688cf7a9decf25b102
tree3671a36cf23d6f124b9c6e098f5abefb5004fff8
parente6e9b35b3931630ca4627508d0c1d10f1a486084
watchdog: imgpdc: Fix probe NULL pointer dereference

The IMG PDC watchdog probe function calls pdc_wdt_stop() prior to
watchdog_set_drvdata(), causing a NULL pointer dereference when
pdc_wdt_stop() retrieves the struct pdc_wdt_dev pointer using
watchdog_get_drvdata() and reads the register base address through it.

Fix by moving the watchdog_set_drvdata() call earlier, to where various
other pdc_wdt->wdt_dev fields are initialised.

Fixes: fd4976208e7d ("watchdog: ImgTec PDC Watchdog Timer Driver")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
Cc: Naidu Tellapati <Naidu.Tellapati@imgtec.com>
Cc: Jude Abraham <Jude.Abraham@imgtec.com>
Cc: linux-watchdog@vger.kernel.org
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
drivers/watchdog/imgpdc_wdt.c