Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1908078ybl; Tue, 3 Dec 2019 14:49:20 -0800 (PST) X-Google-Smtp-Source: APXvYqzgwHV42OIby57KaTYQXtfF0uSIu9o+TWkSNCSPCPIpRz5gJqXSERePVZFjVZUDpaWw571I X-Received: by 2002:a9d:53c9:: with SMTP id i9mr223633oth.172.1575413360142; Tue, 03 Dec 2019 14:49:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575413360; cv=none; d=google.com; s=arc-20160816; b=eyhV7eE9dKKlSyc9pEu2hFFC7I7Fq9srYwuanE6zAOERhFv+KOWB9rH8xVddmXcaqb EMV2DGG7R9T0LFnyAMCQ2wrtNjss95tc3Rl9ztougaEXze+yqWczNgDUesX1PGLb55hY DOtmkL7T2Q+0VtZ5tg6h2NZn9Bj+WJ54kxlwDsmTEk20emlitUb+P6Z2+7dY1P48j2xk aV/21C5l3Y7rxDBHhx/uS9/TzURgkVgyfN+EIdCGMZcV7uU8kKnBw25oN2+EJVgqPLmJ T1a1ACrve92U6fjnuSSjOtnfZrQZ1GQcdEgL/RBQZD+BxuRLlFUvRERa+iXSH9zBVhHo 8KjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tUmFptePA3CovY3MOcS3jBDoq0qiL//y22pZRyvSYg8=; b=kDLptyix+KAFDWP/2FNu/rtygwmZfH0M+puBJ9AxVZetF4miRYz6xd3UudFoRiYk3z 6pIkQCRNncKqKEjT0lUB5vRz52pYEG5vIOItGS2dGXYSN3JBwRUl6xDbm5FHO57mVpVJ yKiMGL2aIX2ErLOsJnmmlag7k/t1ou+fuVUw5nqY0uX6P2L6mABlvmL7X9oISR1uHmhB tWUG5XOhPWXtkF2ZtvtIoGCk1bj3aO1wydi+8G9Mut5SXbb6vdRzy7+1w6Da6/56pqgb yCtLp9eZtvw+qLQ9hWxKo5eKtyyc2G3wS6J5rSXtA4lT/8vrBA2nmk1YyHJQyvHH93P4 IFJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KBa9Dsxd; 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 h22si2106626otn.279.2019.12.03.14.49.08; Tue, 03 Dec 2019 14:49:20 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=KBa9Dsxd; 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 S1729464AbfLCWsi (ORCPT + 99 others); Tue, 3 Dec 2019 17:48:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:39248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729155AbfLCWsg (ORCPT ); Tue, 3 Dec 2019 17:48:36 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3E04720656; Tue, 3 Dec 2019 22:48:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575413315; bh=KuQUYgjE/jl4rzGGVvalCHJiUrChKVVEEiIPzv+P1Y8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KBa9Dsxd3DbyYwiW2WAl4+s1SmruLXoqvqeEUDgY19p8/xVazp5SSuV2OUa3Uf8Cc E052nczFAEmGAFW8oViLXxEHdLk2LfVtjKzvIHT8YJXFCrTb/+Qo0+DijYVnHdFiXF DVj5hpu0qfVhphdHgXRuNT/QQRpBSRKmvV5d25+c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ahmed Zaki , Johannes Berg , Sasha Levin Subject: [PATCH 4.19 044/321] mac80211: fix station inactive_time shortly after boot Date: Tue, 3 Dec 2019 23:31:50 +0100 Message-Id: <20191203223429.401517191@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191203223427.103571230@linuxfoundation.org> References: <20191203223427.103571230@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ahmed Zaki [ Upstream commit 285531f9e6774e3be71da6673d475ff1a088d675 ] In the first 5 minutes after boot (time of INITIAL_JIFFIES), ieee80211_sta_last_active() returns zero if last_ack is zero. This leads to "inactive time" showing jiffies_to_msecs(jiffies). # iw wlan0 station get fc:ec:da:64:a6:dd Station fc:ec:da:64:a6:dd (on wlan0) inactive time: 4294894049 ms . . connected time: 70 seconds Fix by returning last_rx if last_ack == 0. Signed-off-by: Ahmed Zaki Link: https://lore.kernel.org/r/20191031121243.27694-1-anzaki@gmail.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/sta_info.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index f34202242d24d..507409e3fd39c 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2356,7 +2356,8 @@ unsigned long ieee80211_sta_last_active(struct sta_info *sta) { struct ieee80211_sta_rx_stats *stats = sta_get_last_rx_stats(sta); - if (time_after(stats->last_rx, sta->status_stats.last_ack)) + if (!sta->status_stats.last_ack || + time_after(stats->last_rx, sta->status_stats.last_ack)) return stats->last_rx; return sta->status_stats.last_ack; } -- 2.20.1