From patchwork Thu Oct 25 21:13:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brendan Higgins X-Patchwork-Id: 989372 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="LU+YlPup"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42h0Jz1kPkz9sCr for ; Fri, 26 Oct 2018 08:15:31 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726916AbeJZFtn (ORCPT ); Fri, 26 Oct 2018 01:49:43 -0400 Received: from mail-pl1-f201.google.com ([209.85.214.201]:36192 "EHLO mail-pl1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725941AbeJZFtn (ORCPT ); Fri, 26 Oct 2018 01:49:43 -0400 Received: by mail-pl1-f201.google.com with SMTP id j9-v6so6617944plt.3 for ; Thu, 25 Oct 2018 14:15:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=QbCm2b2jNj8XmLM7XlmD64yFu5BCDMsTfbaLrwEEm/U=; b=LU+YlPup8hvUy7rlwpRbnGWtbuoJ+95RpB8tnnEQCfJnStc9SUQAz5GhNWpqR4Xxzl bTHbt+4HE6kjQfyJWIXVWpPJS39KJxA1frw5JESn7UbS8ay7h4koEloNYsb862HAsW4d nrZlOJG3AS8J28qsvYW7mmrE519JmIgktPk5r9g3hjW4RD2q80I59MznJRTCC6qBiC1q tLvlQRxLs9v//OWZ/H+CG3nbO1c3QWIr7+0C1xn102nOa3PxqEOylQtUaJAniPNXrKt8 gPwLPzw977Z2lMTTcYVHHbzw5BFdXKVQudWeoaOtSKTmfRxfnbhm6pVaLIhKjjxMGbp8 lNww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=QbCm2b2jNj8XmLM7XlmD64yFu5BCDMsTfbaLrwEEm/U=; b=qqp2uUH3mADUJrdUkDFliHSThyqaaAxr59kQ5HLmRzLKwW4kaQvnvre1+qrHXCAot8 PUxd9+fU6AtrSL0OMPrblBL7zehg03fTB7EhSACc1ynWCQwVvEYXzp5mDeCnC1P6CF1P k6uaLXHIugoNJT9ovvD+qTeYGP7td/u524KUptOjTX/rj6h7up3iPre0qv2u2zDRj0LM S3krqHYc9gqisnFLi3yVOucWWd8Ez0YplCN9p+izTcJoN+gt+XmdNKQyqEqnmeOhu8Yl wbYCc9Hn0jehPuFQogAZt3qPeXk18vMT0WYsxUUXSCFCQQftoy1V0I2hDnMMEmy4PYav 3wzw== X-Gm-Message-State: AGRZ1gL4+HpECtVclgzEwWEPqnku/p5LVpjKMozEvBaka/30zRKOWKCC CrNwjIzpyZKHHFGoR8x23NRnjvgJ9Pv3+5YKLkCMBA== X-Google-Smtp-Source: AJdET5d3jVmD8n48xCNKE/8QXcx56Ser8wW3DsyKEE2GOxB7s8RPMkAEjad154BGMBGN6vpBvmlnhDCjEu9nY6Gw5HAjQA== X-Received: by 2002:a63:3049:: with SMTP id w70-v6mr595838pgw.18.1540502124732; Thu, 25 Oct 2018 14:15:24 -0700 (PDT) Date: Thu, 25 Oct 2018 14:13:52 -0700 Message-Id: <20181025211352.112096-1-brendanhiggins@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.19.1.568.g152ad8e336-goog Subject: [PATCH v1] net: ipv6: fix racey clock check in route cache aging logic From: Brendan Higgins To: davem@davemloft.net, kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Brendan Higgins Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Fix a bug where, with certain settings, the aging logic does not use the time passed in as the current time, but instead directly checks jiffies. This bug can be reproduced with (and this fix verified with) the test at: https://kunit-review.googlesource.com/c/linux/+/1156 Fixes: 31afeb425f7f ("ipv6: change route cache aging logic") Discovered-by-KUnit: https://kunit-review.googlesource.com/c/linux/+/1156 Signed-off-by: Brendan Higgins --- net/ipv6/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 2a7423c394560..54d28b91fd840 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -1734,7 +1734,7 @@ static void rt6_age_examine_exception(struct rt6_exception_bucket *bucket, rt6_remove_exception(bucket, rt6_ex); return; } - } else if (time_after(jiffies, rt->dst.expires)) { + } else if (time_after(now, rt->dst.expires)) { RT6_TRACE("purging expired route %p\n", rt); rt6_remove_exception(bucket, rt6_ex); return;