From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A872C43381 for ; Fri, 22 Feb 2019 19:22:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E426C20700 for ; Fri, 22 Feb 2019 19:22:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726368AbfBVTWY (ORCPT ); Fri, 22 Feb 2019 14:22:24 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:56212 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725832AbfBVTWY (ORCPT ); Fri, 22 Feb 2019 14:22:24 -0500 Received: from localhost (unknown [IPv6:2601:601:9f80:35cd::bf5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 5FCC214A7353E; Fri, 22 Feb 2019 11:22:23 -0800 (PST) Date: Fri, 22 Feb 2019 11:22:22 -0800 (PST) Message-Id: <20190222.112222.1641489327512557605.davem@davemloft.net> To: kwiecienmaciek@gmail.com Cc: linux-sctp@vger.kernel.org, netdev@vger.kernel.org, alexander.sverdlin@nokia.com, maciej.kwiecien@nokia.com Subject: Re: [PATCH] sctp: don't compare hb_timer expire date before starting it From: David Miller In-Reply-To: <20190222084526.8214-1-maciej.kwiecien@nokia.com> References: <20190222084526.8214-1-maciej.kwiecien@nokia.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Fri, 22 Feb 2019 11:22:23 -0800 (PST) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: kwiecienmaciek@gmail.com Date: Fri, 22 Feb 2019 09:45:26 +0100 > From: Maciej Kwiecien > > hb_timer might not start at all for a particular transport because its > start is conditional. In a result a node is not sending heartbeats. > > Function sctp_transport_reset_hb_timer has two roles: > - initial start of hb_timer for a given transport, > - update expire date of hb_timer for a given transport. > The function is optimized to update timer's expire only if it is before > a new calculated one but this comparison is invalid for a timer which > has not yet started. Such a timer has expire == 0 and if a new expire > value is bigger than (MAX_JIFFIES / 2 + 2) then "time_before" macro will > fail and timer will not start resulting in no heartbeat packets send by > the node. > > This was found when association was initialized within first 5 mins > after system boot due to jiffies init value which is near to MAX_JIFFIES. > > Test kernel version: 4.9.154 (ARCH=arm) > hb_timer.expire = 0; //initialized, not started timer > new_expire = MAX_JIFFIES / 2 + 2; //or more > time_before(hb_timer.expire, new_expire) == false > > Fixes: ba6f5e33bdbb ("sctp: avoid refreshing heartbeat timer too often") > Reported-by: Marcin Stojek > Tested-by: Marcin Stojek > Signed-off-by: Maciej Kwiecien Applied and queued up for -stable, thank you.