From mboxrd@z Thu Jan 1 00:00:00 1970 From: Doron Roberts-Kedes Subject: [PATCH net] strparser: Do not call mod_delayed_work with a timeout of LONG_MAX Date: Fri, 20 Apr 2018 12:11:11 -0700 Message-ID: <20180420191111.683209-1-doronrk@fb.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Tejun Heo , , Doron Roberts-Kedes To: David Miller Return-path: Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:46154 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752245AbeDTTLt (ORCPT ); Fri, 20 Apr 2018 15:11:49 -0400 Received: from pps.filterd (m0148461.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3KJ7wk7008210 for ; Fri, 20 Apr 2018 12:11:49 -0700 Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2hfj110ra5-5 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Fri, 20 Apr 2018 12:11:48 -0700 Sender: netdev-owner@vger.kernel.org List-ID: struct sock's sk_rcvtimeo is initialized to LONG_MAX/MAX_SCHEDULE_TIMEOUT in sock_init_data. Calling mod_delayed_work with a timeout of LONG_MAX causes spurious execution of the work function. timer->expires is set equal to jiffies + LONG_MAX. When timer_base->clk falls behind the current value of jiffies, the delta between timer_base->clk and jiffies + LONG_MAX causes the expiration to be in the past. Returning early from strp_start_timer if timeo == LONG_MAX solves this problem. Found while testing net/tls_sw recv path. Fixes: 43a0c6751a322847 ("strparser: Stream parser for messages") Reviewed-by: Tejun Heo Signed-off-by: Doron Roberts-Kedes --- net/strparser/strparser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/strparser/strparser.c b/net/strparser/strparser.c index 805b139..092bebc 100644 --- a/net/strparser/strparser.c +++ b/net/strparser/strparser.c @@ -67,7 +67,7 @@ static void strp_abort_strp(struct strparser *strp, int err) static void strp_start_timer(struct strparser *strp, long timeo) { - if (timeo) + if (timeo && timeo != LONG_MAX) mod_delayed_work(strp_wq, &strp->msg_timer_work, timeo); } -- 2.9.5