• James Hogan's avatar
    watchdog: imgpdc: Fix probe NULL pointer dereference · a629c08f
    James Hogan authored
    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: 93937669 ("watchdog: ImgTec PDC Watchdog Timer Driver")
    Signed-off-by: default avatarJames 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: default avatarGuenter Roeck <linux@roeck-us.net>
    Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
    a629c08f
imgpdc_wdt.c 7.84 KB