mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiayi Zhang <zhangjiayi1014@gmail.com>
To: Johan Hovold <johan@kernel.org>, Alex Elder <elder@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Rui Miguel Silva <rui.silva@linaro.org>,
	Farhad Alemi <farhad.alemi@berkeley.edu>,
	greybus-dev@lists.linaro.org, linux-kernel@vger.kernel.org,
	syzbot+e6bea924b5ee24f7cb98@syzkaller.appspotmail.com,
	syzkaller-bugs@googlegroups.com,
	Jiayi Zhang <zhangjiayi1014@gmail.com>
Subject: [PATCH] greybus: svc_watchdog: initialize reset_work only once
Date: Fri, 27 Nov 2026 07:52:43 +0000	[thread overview]
Message-ID: <20261127075243.3413794-1-zhangjiayi1014@gmail.com> (raw)

reset_work is a file-scope delayed work shared by all SVC watchdogs, but
do_work() calls INIT_DELAYED_WORK() on it every time a ping fails, right
before scheduling it to run half a second later. With two host devices,
the watchdog of the second SVC can see its ping fail while the work
scheduled by the first one is still pending. INIT_DELAYED_WORK() then
reinitializes a timer that is still enqueued, and debugobjects reports:

  greybus 1-svc: Resetting the greybus network, watch out!!!
  greybus 2-svc: Resetting the greybus network, watch out!!!
  ODEBUG: init active (active state 0) object: ffffffff9bda1f68 object type: timer_list hint: greybus_reset+0x0/0x50
  WARNING: lib/debugobjects.c:629 at debug_print_object+0x198/0x2b0
  Workqueue: events do_work
  Call Trace:
   __debug_object_init
   timer_init_key
   do_work drivers/greybus/svc_watchdog.c:92
   process_one_work

Without CONFIG_DEBUG_OBJECTS_TIMERS nothing catches this and the timer
is added to the timer wheel a second time while it is still linked there.

Initialize reset_work once with DECLARE_DELAYED_WORK() and only schedule
it from do_work(). schedule_delayed_work() does nothing when the work is
already pending, which is what is wanted here: greybus_reset() resets the
whole greybus network, so one run serves both watchdogs.

Fixes: ed7279ae31b0 ("greybus: svc: add a "watchdog" to check the network health")
Reported-by: syzbot+e6bea924b5ee24f7cb98@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=e6bea924b5ee24f7cb98
Link: https://lore.kernel.org/r/CA+0ovCiyBFo_gx4UaRN095=MdWaBgKm=TqA1uYdOu-hb_BPt6A@mail.gmail.com/
Signed-off-by: Jiayi Zhang <zhangjiayi1014@gmail.com>
---
Compile tested only (allmodconfig, W=1); syzbot has no reproducer for
this report.

AI tools assisted with the analysis, the code and the changelog.

 drivers/greybus/svc_watchdog.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/greybus/svc_watchdog.c b/drivers/greybus/svc_watchdog.c
index b318eb34bcca..11eb7c961b06 100644
--- a/drivers/greybus/svc_watchdog.c
+++ b/drivers/greybus/svc_watchdog.c
@@ -20,8 +20,6 @@ struct gb_svc_watchdog {
 	struct notifier_block pm_notifier;
 };
 
-static struct delayed_work reset_work;
-
 static int svc_watchdog_pm_notifier(struct notifier_block *notifier,
 				    unsigned long pm_event, void *unused)
 {
@@ -61,6 +59,8 @@ static void greybus_reset(struct work_struct *work)
 	call_usermodehelper(start_path, argv, envp, UMH_WAIT_EXEC);
 }
 
+static DECLARE_DELAYED_WORK(reset_work, greybus_reset);
+
 static void do_work(struct work_struct *work)
 {
 	struct gb_svc_watchdog *watchdog;
@@ -89,7 +89,6 @@ static void do_work(struct work_struct *work)
 		} else if (svc->action == GB_SVC_WATCHDOG_BITE_RESET_UNIPRO) {
 			dev_err(&svc->dev, "Resetting the greybus network, watch out!!!\n");
 
-			INIT_DELAYED_WORK(&reset_work, greybus_reset);
 			schedule_delayed_work(&reset_work, HZ / 2);
 
 			/*

base-commit: 9437ee8b6cf607e883b36e44bd755968daaebd48
-- 
2.53.0


             reply	other threads:[~2026-11-27  7:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27  7:52 Jiayi Zhang [this message]
2026-11-27  8:01 ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261127075243.3413794-1-zhangjiayi1014@gmail.com \
    --to=zhangjiayi1014@gmail.com \
    --cc=elder@kernel.org \
    --cc=farhad.alemi@berkeley.edu \
    --cc=gregkh@linuxfoundation.org \
    --cc=greybus-dev@lists.linaro.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rui.silva@linaro.org \
    --cc=syzbot+e6bea924b5ee24f7cb98@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®