Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932747AbbLGUQf (ORCPT ); Mon, 7 Dec 2015 15:16:35 -0500 Received: from www.linutronix.de ([62.245.132.108]:41495 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932593AbbLGUQe (ORCPT ); Mon, 7 Dec 2015 15:16:34 -0500 Date: Mon, 7 Dec 2015 21:15:45 +0100 (CET) From: Thomas Gleixner To: John Stultz cc: Richard Cochran , Sasha Levin , lkml Subject: Re: [PATCH] time: verify time values in adjtimex ADJ_SETOFFSET to avoid overflow In-Reply-To: Message-ID: References: <1449198571-21133-1-git-send-email-sasha.levin@oracle.com> <56637E2D.1040603@oracle.com> <20151206221149.GA22451@netboy> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1021 Lines: 31 On Mon, 7 Dec 2015, John Stultz wrote: > On Sun, Dec 6, 2015 at 2:11 PM, Richard Cochran > wrote: > > The overflow is a latent problem, and the patch should: > > > > 1. return error in case (txc->time.tv_usec >= USEC_PER_SEC) > > 2. remove the redundant test in timekeeping_inject_offset. > > So we probably want to keep the check in timekeeping_inject_offset() > since there can be other users as well of that function. > > But its probably cleanest to add a check in ntp_validate_timex() > instead of where this patch does it. So instead of open coding the checks on both sites, can we please have an inline function with proper comments why time.tv_sec can be negative, something like adjtimex_timeval_is_valid() or such. Thanks, tglx -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/