Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6670767ybi; Mon, 8 Jul 2019 06:49:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwHZCq2uCc1szg9a9BOrQ/FXUTDWimULcwX8uR/q9Qx1v09vN5gqayqnflHVAbBV/XIiz+ X-Received: by 2002:a63:5a4b:: with SMTP id k11mr24097968pgm.143.1562593752941; Mon, 08 Jul 2019 06:49:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562593752; cv=none; d=google.com; s=arc-20160816; b=DR7T9+wcqzXmIY3cuob+MLCVJczkXNOW0KUyg3I1POjQfrWnMx1AgB8pvgfWgtGnzu 2hetkKGSvJ/13Ssoj3mrQpoDDTlG6JdDnR+6m3IpdyCr0rxzDeTRkvZ2JdMVX85KLjS9 MGpj2szikPi8wB9+CO7SMz9OSmmQxHHnOGLa5TRGcKs2Y/dDhH4r1cSUmUQ4ROCSZKdZ 2SqJXVtw1U39oBnxQID6iv5kwXeOwVxv63ApWIfyspQsD4VdLvEVPbgkS+RKCL34EDQ3 XWWcRdxdzu091Ze3yDYmxSdz/VtBsGRyGFu288OTBkrthQPWfiJlv9nXp6pi0pF8NEYD NMpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=UMhvibATNjA8jmLe5KCV7CtAa6k+55du4Zf1DahNSxQ=; b=cpWJi0LdxWl4E5uLdn4crMtItx/JptRnWI0eukGHIj7nskcQNKDjwcE6pFEodiVhvC z0LXvccGZ3oqcA4+fnmsFutRJcvm308d5IIqu+/b6hLl6s7yqFZayddFeQ2HkwKLbnCF J8SAwumBoxNTQH+1Plp6tZlgf+8fGYCD7IrWpoUY+i8xxtAQR6PfY9F5fSOE2h7odev2 FvfcPPrHXtjZzHA87lfXedTYwB5hRTYKBJ/gLHfbCAbOxVUo5YCb+2dOVhXx11l5oSTc TFuSolGMCi/vBVvffits1Knj5dlwUGIXDWYVVct2IZDtopPDid1nwLCxtDjYoe6wkJs2 IN5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d25si7449321pge.301.2019.07.08.06.48.57; Mon, 08 Jul 2019 06:49:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729059AbfGHJZG (ORCPT + 99 others); Mon, 8 Jul 2019 05:25:06 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:38883 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727401AbfGHJZG (ORCPT ); Mon, 8 Jul 2019 05:25:06 -0400 Received: from pd9ef1cb8.dip0.t-ipconnect.de ([217.239.28.184] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1hkPtM-0004vd-VP; Mon, 08 Jul 2019 11:25:01 +0200 Date: Mon, 8 Jul 2019 11:24:59 +0200 (CEST) From: Thomas Gleixner To: ZhangXiaoxu cc: john.stultz@linaro.org, sboyd@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] time: Validate the usec before covert to nsec in do_adjtimex In-Reply-To: <1562572504-142115-1-git-send-email-zhangxiaoxu5@huawei.com> Message-ID: References: <1562572504-142115-1-git-send-email-zhangxiaoxu5@huawei.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 8 Jul 2019, ZhangXiaoxu wrote: > When covert the usec to nsec, it will multiple 1000, it maybe > overflow and lead an undefined behavior. > > For example, users may input an negative tv_usec values when > call adjtimex syscall, then multiple 1000 maybe overflow it > to a positive and legal number. > > So, we should validate the usec before coverted it to nsec. That's correct, but the actuall inject function wants to keep the sanity check, Thanks, tglx