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=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 D4307C28CC1 for ; Sat, 1 Jun 2019 13:30:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9DA502745B for ; Sat, 1 Jun 2019 13:30:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559395813; bh=0ar076jmH0sMsMaf6T/4hb3NCEfzVN9jqdWdJ3pX69Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=TthQFLllttQuQ7L3Ryb2GziEbg4Crsy6fg6fRkesG2RD/eVqVGsZGM+h8qzbK6tzy M3qsVHE6JlOJNB0CALIPsl2LZ+KdAd9QNjbx6fBxuQTt5AuQlb2p4MSWPr22hLYjvI fv+exhyKAZmxx/L2UNZ4JzYqkC9BFd04stQfOdfA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729826AbfFANaN (ORCPT ); Sat, 1 Jun 2019 09:30:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:56882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729709AbfFAN02 (ORCPT ); Sat, 1 Jun 2019 09:26:28 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0E7F9273C1; Sat, 1 Jun 2019 13:26:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559395588; bh=0ar076jmH0sMsMaf6T/4hb3NCEfzVN9jqdWdJ3pX69Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sDH+nRSZkqvhzYkL5EGLT5iU504PfISYXMIVqtLULvAroNzyOtwjlPEe/JHOMkXFQ O8pO1nRa6qu5iyAZB2r0N5ED7G+NzliC5lxBUBbrWulycfKt1d6MovwcyLjf16bSoX hE9UWt1FlorIBwUtGwJNI3cm1UlCDYo9tsfxmrIM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Miroslav Lichvar , Ondrej Mosnacek , Thomas Gleixner , John Stultz , Richard Cochran , Prarit Bhargava , Sasha Levin Subject: [PATCH AUTOSEL 4.4 13/56] ntp: Allow TAI-UTC offset to be set to zero Date: Sat, 1 Jun 2019 09:25:17 -0400 Message-Id: <20190601132600.27427-13-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190601132600.27427-1-sashal@kernel.org> References: <20190601132600.27427-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miroslav Lichvar [ 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 ab861771e37f8..0e0dc5d89911d 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -633,7 +633,7 @@ static inline void process_adjtimex_modes(struct timex *txc, 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