From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 700F4C31E45 for ; Thu, 13 Jun 2019 16:19:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4134420644 for ; Thu, 13 Jun 2019 16:19:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560442792; bh=D80zUZagERK3VG96zY69ItG3mgc6LTMnoqeh+qlyOno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Dc5Nm5aO+ezRJYzsrTt/b9bffAX4+bw6ol2oq82RXnAtmmbUKTXx7c4677HFZ1M3V Xx4HMxsIH3pgLQp4sl7Qty7jMr7YPDyFib412wofIzZLtJEH5wqZS9C1bzc/g2XLkz 4li9Twl+r2cC6z2r/ruGZex6L701IqmdOvZmoWQ8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392088AbfFMQTv (ORCPT ); Thu, 13 Jun 2019 12:19:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:57190 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731089AbfFMIjm (ORCPT ); Thu, 13 Jun 2019 04:39:42 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EE51621473; Thu, 13 Jun 2019 08:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560415182; bh=D80zUZagERK3VG96zY69ItG3mgc6LTMnoqeh+qlyOno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sJHxyxOldmLmsLuFYIeuFVDfLyTZp24lS8wNkWa3ikOBiz4R4aNleh2nRmQ7uD3dS Gib2XpGUWmVrNojBY8Wd+F1PZW4EwGB5CJVT1cxgWwCM272JCD8wBsD95/IElEFswl C4SBaZwRD/+MkChKci1vF9nz9ThHj6fe95L48tOw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ondrej Mosnacek , Miroslav Lichvar , Thomas Gleixner , John Stultz , Richard Cochran , Prarit Bhargava , Sasha Levin Subject: [PATCH 4.19 032/118] ntp: Allow TAI-UTC offset to be set to zero Date: Thu, 13 Jun 2019 10:32:50 +0200 Message-Id: <20190613075645.362258448@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190613075643.642092651@linuxfoundation.org> References: <20190613075643.642092651@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit fdc6bae940ee9eb869e493990540098b8c0fd6ab ] The ADJ_TAI adjtimex mode sets the TAI-UTC offset of the system clock. It is typically set by NTP/PTP implementations and it is automatically updated by the kernel on leap seconds. The initial value is zero (which applications may interpret as unknown), but this value cannot be set by adjtimex. This limitation seems to go back to the original "nanokernel" implementation by David Mills. Change the ADJ_TAI check to accept zero as a valid TAI-UTC offset in order to allow setting it back to the initial value. Fixes: 153b5d054ac2 ("ntp: support for TAI") Suggested-by: Ondrej Mosnacek Signed-off-by: Miroslav Lichvar Signed-off-by: Thomas Gleixner Cc: John Stultz Cc: Richard Cochran Cc: Prarit Bhargava Link: https://lkml.kernel.org/r/20190417084833.7401-1-mlichvar@redhat.com Signed-off-by: Sasha Levin --- kernel/time/ntp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index c5e0cba3b39c..6b23cd584295 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -698,7 +698,7 @@ static inline void process_adjtimex_modes(const struct timex *txc, s32 *time_tai time_constant = max(time_constant, 0l); } - if (txc->modes & ADJ_TAI && txc->constant > 0) + if (txc->modes & ADJ_TAI && txc->constant >= 0) *time_tai = txc->constant; if (txc->modes & ADJ_OFFSET) -- 2.20.1