Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C81B4D17A4; Thu, 17 Sep 2026 17:26:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789666004; cv=none; b=D3fQ3UcupyZFwTdmbmTUoJKlLHMU2J0lrUdS8QHFrDN+26xs8DAzasfXrXu2JosaRjFF1kBSCib/aMcs/PzdzLedRwhMH+/5SbUV7Xk9ulFCIvbMHUkYHsuFb2FXfl0TrVtGWNqoDD8Yt1LwR5rZd1V+S42kNDSjQ7nGjhE+7u8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789666004; c=relaxed/simple; bh=fJsc584zX0UfHPlmnWqNa/J4/NfM7PzeiXoh6LRGbYo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CwgXPg107DxRMLW8nOuaJ65yUFsNI7RxSdmYLHbM+PzuuNk1uvXlC8ZJkOgqyOtTyTYQfWXQ1IiFr86NPFvr5OL0DHI1UBv14iYb89oxfL10E5SZEWIX7L6NVwmTLOhWbcharcIiOmEcngqYb4bEaVWSvpmwiTqsTdAx4Sff3Cg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=CBH9tebg; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="CBH9tebg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 589261F000FF; Thu, 17 Sep 2026 17:26:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789666002; bh=BeQdFrc2kI8J6INIrgIRsYKiMD6/hC8HOG/0kV0tGcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=CBH9tebgXzBgusS3vJhd8/20tmNBT4Reyk1PlX9hs6ESep8FlLKaQVKM8v0AvjCiR fN3JE597McYVnKpKqbiImxOdA5tJ9BTZh0xmbks0HbSTZs3Yo1dWQvCYNy63w0DnSC R8TvyhMPhATCFLFMrs8OeWcooF7Ti9VmaN38nuck= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, David Arcari , Guenter Roeck , Sasha Levin Subject: [PATCH 6.18 0891/1250] watchdog: fix hrtimer start when pretimeout is zero Date: Thu, 17 Sep 2026 16:11:26 +0100 Message-ID: <20260917151616.136134337@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260917151551.901433442@linuxfoundation.org> References: <20260917151551.901433442@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Arcari [ Upstream commit 0fa37512eb747e4ffdcf367274f9e72845f1bca4 ] Per the watchdog API, a pretimeout value of 0 disables the feature. However, watchdog_hrtimer_pretimeout_start() fails to verify if the pretimeout is non-zero before arming the timer. This omission inadvertently starts the software pretimeout timer, which could result in the pretimeout handler executing incorrectly when the watchdog timeout is reached. Fix this by adding a check for wdd->pretimeout before calling hrtimer_start(), ensuring the disabled state is respected. Fixes: 7b7d2fdc8c3e ("watchdog: Add hrtimer-based pretimeout feature") Signed-off-by: David Arcari Link: https://patch.msgid.link/20260903182029.936030-1-darcari@redhat.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/watchdog/watchdog_hrtimer_pretimeout.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/watchdog/watchdog_hrtimer_pretimeout.c b/drivers/watchdog/watchdog_hrtimer_pretimeout.c index fbc7eecd8b203..49a05ea60c979 100644 --- a/drivers/watchdog/watchdog_hrtimer_pretimeout.c +++ b/drivers/watchdog/watchdog_hrtimer_pretimeout.c @@ -30,6 +30,7 @@ void watchdog_hrtimer_pretimeout_init(struct watchdog_device *wdd) void watchdog_hrtimer_pretimeout_start(struct watchdog_device *wdd) { if (!(wdd->info->options & WDIOF_PRETIMEOUT) && + wdd->pretimeout && !watchdog_pretimeout_invalid(wdd, wdd->pretimeout)) hrtimer_start(&wdd->wd_data->pretimeout_timer, ktime_set(wdd->timeout - wdd->pretimeout, 0), -- 2.53.0