• Jean Delvare's avatar
    watchdog: wdat_wdt: Set the min and max timeout values properly · 926e0992
    Jean Delvare authored
    The wdat_wdt driver is misusing the min_hw_heartbeat_ms field. This
    field should only be used when the hardware watchdog device should not
    be pinged more frequently than a specific period. The ACPI WDAT
    "Minimum Count" field, on the other hand, specifies the minimum
    timeout value that can be set. This corresponds to the min_timeout
    field in Linux's watchdog infrastructure.
    
    Setting min_hw_heartbeat_ms instead can cause pings to the hardware
    to be delayed when there is no reason for that, eventually leading to
    unexpected firing of the watchdog timer (and thus unexpected reboot).
    
    Since commit 6d72c7ac ("watchdog: wdat_wdt: Using the existing
    function to check parameter timeout"), min_timeout is being set too,
    but to the arbitrary value of 1 second, which doesn't make sense and
    allows setting timeout values lower that the ACPI WDAT "Minimum
    Count" field.
    
    I'm also changing max_hw_heartbeat_ms to max_timeout for symmetry,
    although the use of this one isn't fundamentally wrong, but there is
    also no reason to enable the software-driven ping mechanism for the
    wdat_wdt driver.
    Signed-off-by: default avatarJean Delvare <jdelvare@suse.de>
    Fixes: 058dfc76 ("ACPI / watchdog: Add support for WDAT hardware watchdog")
    Fixes: 6d72c7ac ("watchdog: wdat_wdt: Using the existing function to check parameter timeout")
    Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
    Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
    Cc: Wim Van Sebroeck <wim@linux-watchdog.org>
    Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Cc: Liu Xinpeng <liuxp11@chinatelecom.cn>
    Link: https://lore.kernel.org/r/20220823154713.023ee771@endymion.delvareSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
    Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
    926e0992
wdat_wdt.c 13.2 KB