From 3c7e4947e4e471de56ced82323f89732ef9a774f Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 12 Nov 2018 17:28:03 +0100 Subject: [PATCH] phc2sys: Fix crash when trying to synchronize unadjustable clock. A clock that cannot be adjusted has no servo. Check if a servo is present before updating the clock. Signed-off-by: Miroslav Lichvar --- phc2sys.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phc2sys.c b/phc2sys.c index b8f1ea0..a476e63 100644 --- a/phc2sys.c +++ b/phc2sys.c @@ -782,6 +782,11 @@ static int do_loop(struct node *node, int subscriptions) !strcmp(clock->device, node->master->device)) continue; + if (!clock->servo) { + pr_err("cannot update clock without servo"); + return -1; + } + if (clock->clkid == CLOCK_REALTIME && node->master->sysoff_method >= 0) { /* use sysoff */