Message ID | 1428569224-23820-172-git-send-email-lizf@kernel.org |
---|---|
State | New |
Headers | show
Return-Path: <patchwork-forward+bncBCHN3LUNYYJBBYH6TCUQKGQEXFBIN4Q@linaro.org> X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5FDD8218D6 for <linaro@patches.linaro.org>; Thu, 9 Apr 2015 08:59:13 +0000 (UTC) Received: by wiaa2 with SMTP id a2sf15834457wia.1 for <linaro@patches.linaro.org>; Thu, 09 Apr 2015 01:59:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=GUvUldskHBFghi0R3bYTJw9BIBUCunvdgVxkfZz7Pd4=; b=m5XOwMlQJBJN2Mk2q4bj6UwDfpU4Zx1VideuB4LDhqfyTDkWR7m84xrZ/YBvFE81ec 3cL4zwxM7AH6BWEqe0PJFySFffobrzPBIV2DdFOuINRZgxdnw5M+pVllmdI/aOC0E91F Mq74E8RoP83HwgfPG0eJSIMEJJAnr2wb01wasFEQFl6aFtNTHyWs8l8khdjlYTSxY37X GXO6n5w8838X1PYqMLsN3RRhqntN9b/YPoD0kamjkl2HmSyFwh9upuUX6GzZvICtnICT XWXyl5OcvZl+QcKIawnoLP5nSU/LTYcMR6W/hV/ZyA1rmH/e/9k1PV2dbZKZKBcQlamr 3APg== X-Gm-Message-State: ALoCoQkh+EkYFiSp+8MFZutwDCwKv2rfxBN/6QfJgNSH0rAZ2qn18pBqW/5bRJeGt//QAYdAFzE7 X-Received: by 10.112.151.146 with SMTP id uq18mr3103228lbb.20.1428569952672; Thu, 09 Apr 2015 01:59:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.129 with SMTP id m1ls256588laf.76.gmail; Thu, 09 Apr 2015 01:59:12 -0700 (PDT) X-Received: by 10.152.6.34 with SMTP id x2mr3606780lax.47.1428569952537; Thu, 09 Apr 2015 01:59:12 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id i2si10934062lbz.68.2015.04.09.01.59.12 for <patchwork-forward@linaro.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2015 01:59:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbbqq2 with SMTP id qq2so77338814lbb.3 for <patchwork-forward@linaro.org>; Thu, 09 Apr 2015 01:59:12 -0700 (PDT) X-Received: by 10.112.222.133 with SMTP id qm5mr12411296lbc.86.1428569952425; Thu, 09 Apr 2015 01:59:12 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp342799lbt; Thu, 9 Apr 2015 01:59:11 -0700 (PDT) X-Received: by 10.68.227.41 with SMTP id rx9mr53254259pbc.76.1428569950480; Thu, 09 Apr 2015 01:59:10 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oj13si20546006pdb.149.2015.04.09.01.59.08; Thu, 09 Apr 2015 01:59:10 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933785AbbDII6y (ORCPT <rfc822;ivan.khoronzhuk@linaro.org> + 27 others); Thu, 9 Apr 2015 04:58:54 -0400 Received: from mail.kernel.org ([198.145.29.136]:44024 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755018AbbDII6r (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 9 Apr 2015 04:58:47 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A14A2042C; Thu, 9 Apr 2015 08:58:46 +0000 (UTC) Received: from localhost.localdomain (unknown [183.247.163.231]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 26D0120450; Thu, 9 Apr 2015 08:58:39 +0000 (UTC) From: lizf@kernel.org To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, John Stultz <john.stultz@linaro.org>, "Peter Zijlstra (Intel)" <peterz@infradead.org>, Linus Torvalds <torvalds@linux-foundation.org>, Sasha Levin <sasha.levin@oracle.com>, Ingo Molnar <mingo@kernel.org>, Zefan Li <lizefan@huawei.com> Subject: [PATCH 3.4 172/176] ntp: Fixup adjtimex freq validation on 32-bit systems Date: Thu, 9 Apr 2015 16:47:00 +0800 Message-Id: <1428569224-23820-172-git-send-email-lizf@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428569028-23762-1-git-send-email-lizf@kernel.org> References: <1428569028-23762-1-git-send-email-lizf@kernel.org> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: <patchwork-forward.linaro.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linux-kernel-owner@vger.kernel.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: <http://groups.google.com/a/linaro.org/group/patchwork-forward/post>, <mailto:patchwork-forward@linaro.org> List-Help: <http://support.google.com/a/linaro.org/bin/topic.py?topic=25838>, <mailto:patchwork-forward+help@linaro.org> List-Archive: <http://groups.google.com/a/linaro.org/group/patchwork-forward/> List-Unsubscribe: <mailto:googlegroups-manage+836684582541+unsubscribe@googlegroups.com>, <http://groups.google.com/a/linaro.org/group/patchwork-forward/subscribe> |
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 7666b24..e32587e 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -660,10 +660,14 @@ int do_adjtimex(struct timex *txc) return result; } - if (txc->modes & ADJ_FREQUENCY) { - if (LONG_MIN / PPM_SCALE > txc->freq) + /* + * Check for potential multiplication overflows that can + * only happen on 64-bit systems: + */ + if ((txc->modes & ADJ_FREQUENCY) && (BITS_PER_LONG == 64)) { + if (LLONG_MIN / PPM_SCALE > txc->freq) return -EINVAL; - if (LONG_MAX / PPM_SCALE < txc->freq) + if (LLONG_MAX / PPM_SCALE < txc->freq) return -EINVAL; }