From patchwork Mon Jun 18 15:11:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 138991 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4070355lji; Mon, 18 Jun 2018 08:13:03 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLBFs3/e29NAQwSiVfLuoi4M/tJC6dV+JHH6fF1Xgy4Bi6nFQ8jgbSgGsVJ4osVJLEp0Skh X-Received: by 2002:a17:902:e00a:: with SMTP id ca10-v6mr14482959plb.224.1529334782942; Mon, 18 Jun 2018 08:13:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529334782; cv=none; d=google.com; s=arc-20160816; b=bQxeaz87V9mpdD7kEnhe0NVarc3LNih+7CnkbO81REwRxcfisaGdS/9xhhgVZK6OBe ire2IpbMaPTNZR1Srs4iaqkZf2Y6BePWXj3yjnI4aivmq4FLnV52XuZ+caskwR9bHVmK FSR6Fln/ojkKdJsXx5UzQ1KMK84ovsHM2n0xvUpspjwQN3w1c1cmDDn3AidNVCfKGv0c CcIf8DW+vJp9hdPYOIJXV+knYB82iBwuK8JZl2FlDQf5bV+yc5dGxdEFhnSIdo2+I9w9 64RAUy+7hpeQqTLetPV485aDjUV/gddriKXB0/C2ieRa3qTa3BjFYFk4zeiLje2yOw6A Hwiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=fbPR9lVS/9OEz46P4dP/Nh2RIMpZmxjsyWM02VcwFZc=; b=v2X1TBTCUR5s4YxF8jMngVGY3FhHiqgZSPmTCNJiBnbwYlq5FD0daUx8fQEBXdapke mJfARj89qQN+0IXV7H0qF2XiJAHQ8zDOJ/usvTngnqb6aVe4c8PgA9VZswmmUro+ZRMQ TgakdxcetuB0y5kQAOb+aFRYLZ1WZC0Bu/JVip93Vo+VdoiVuyApUwCTLSSgC2O7S061 Q31l2fj9ttPCeZB0ZXqpuI/D5p57XyEx+8lfx32Z27XNP9ey4uOqBUURQK4jC9clBcsB mJtTkEcex6g/MOQl8zF8eI39QUSbEYXIGSr1jyRh9mlPnTDf8dhMrSkVhBBminIQCiL6 kKCA== 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 g28-v6si17162950plj.307.2018.06.18.08.13.02; Mon, 18 Jun 2018 08:13:02 -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 S1754904AbeFRPNB (ORCPT + 30 others); Mon, 18 Jun 2018 11:13:01 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:42161 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754601AbeFRPM5 (ORCPT ); Mon, 18 Jun 2018 11:12:57 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0MN3u4-1fbXWU3ktc-006bN2; Mon, 18 Jun 2018 17:11:47 +0200 From: Arnd Bergmann To: Johannes Berg , "David S. Miller" Cc: y2038@lists.linaro.org, Arnd Bergmann , Denis Kenzior , Avraham Stern , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] cfg80211: track time using boottime Date: Mon, 18 Jun 2018 17:11:14 +0200 Message-Id: <20180618151142.1214422-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:iR3hvAtd74kynI32m9Sy9zzWb4Woz8XM6PWniSLf5dkz1CNPl8Y K7JZZs4FS0VToyUxfIHgkvkPkh23I0vyhU9q0udYW7bcnW2K2T/v8PKowdpQO6kxAqHeydy s4WsGKtqEBhw2u2aZrXEeFh7tiKQB+puYs1B5UGkCwBE6nxEfQa2BwiYe8T/4KMa1B2n5FL eJYnYbuNMBpFlcM2eLo1g== X-UI-Out-Filterresults: notjunk:1; V01:K0:wOajXHmDs7o=:NfbAIxEPQjUoHe1kQN2w3Z sEFlRHi+BjF3Vlu/RSdbdVl+Mv/LU/rmqdAIZ57siT0wa3TZUeGwDsi6oIwb++PS0Rz8dR5TW ZIOb7zx5M/TM6ITByOFpi3oic5dAsjqkWfsLc3f1DFQe3cuG69l+wuLfvz+szg+3/6fPAU5Wo KWH+AZahqcgIWdwGL7i6axcYGmMyXJ9EgwfI1vHtKjpFw6Wi4UMZaYsaS/wx4yoyJOJDsmOBD NbCCMaNrT1hv9leds2lFnmW4tVE/PpgsIuLcQzAeG98WeEe6YPxl8+k3QAUb+148PwhLPyKig zLgMBhbB7UwIdVklwh0C/iz3qm8CJFJOeSdS+oHktwSpwekZzrOdM/Th7/WpaY8okiW9VCfQ9 N/61MbAsKolv3ZEy2uHbJNhZPg5S4LyPxNFUEE1GEbN+v+jLT5R4EzJG+kWZVKYsDmQEHql5P /WVypBCKkJ8IvZR5fW+ddbsy2wLx/KbbR88AinsTc2ub7vlmDvj/VedrXVZEJ7dKJvrwVy0gm 4I2ZyJ+/5NetJFrP7jLMJmWHAdxQP1IGe5z7HkZb/vaL8myCGKoBGVvjo7EOYrCamKeYb9MwR mn0JlZmvOiS/yG9jROFtIB2+MtsIN3G0bRJqJFNm8SDJeh0B6qxC8dhzukPA8nbPhDTQ9z6cV /rST7h9akvfP6K+vrlBwQfwM1Hv1GmkUJUD5eUNnA+pVWSYWu5oSLQC178V/libBHGi0= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cfg80211 layer uses get_seconds() to read the current time in its supend handling. This function is deprecated because of the 32-bit time_t overflow, and it can cause unexpected behavior when the time changes due to settimeofday() calls or leap second updates. In many cases, we want to use monotonic time instead, however cfg80211 explicitly tracks the time spent in suspend, so this changes the driver over to use ktime_get_boottime_seconds(), which is slightly slower, but not used in a fastpath here. Signed-off-by: Arnd Bergmann --- net/wireless/core.h | 2 +- net/wireless/sysfs.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) -- 2.9.0 diff --git a/net/wireless/core.h b/net/wireless/core.h index 63eb1b5fdd04..7f52ef569320 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h @@ -76,7 +76,7 @@ struct cfg80211_registered_device { struct cfg80211_scan_request *scan_req; /* protected by RTNL */ struct sk_buff *scan_msg; struct list_head sched_scan_req_list; - unsigned long suspend_at; + time64_t suspend_at; struct work_struct scan_done_wk; struct genl_info *cur_cmd_info; diff --git a/net/wireless/sysfs.c b/net/wireless/sysfs.c index 570a2b67ca10..6ab32f6a1961 100644 --- a/net/wireless/sysfs.c +++ b/net/wireless/sysfs.c @@ -102,7 +102,7 @@ static int wiphy_suspend(struct device *dev) struct cfg80211_registered_device *rdev = dev_to_rdev(dev); int ret = 0; - rdev->suspend_at = get_seconds(); + rdev->suspend_at = ktime_get_boottime_seconds(); rtnl_lock(); if (rdev->wiphy.registered) { @@ -130,7 +130,7 @@ static int wiphy_resume(struct device *dev) int ret = 0; /* Age scan results with time spent in suspend */ - cfg80211_bss_age(rdev, get_seconds() - rdev->suspend_at); + cfg80211_bss_age(rdev, ktime_get_boottime_seconds() - rdev->suspend_at); rtnl_lock(); if (rdev->wiphy.registered && rdev->ops->resume)