summaryrefslogtreecommitdiff
path: root/net/strparser/strparser.c
diff options
context:
space:
mode:
authorDoron Roberts-Kedes <doronrk@fb.com>2018-04-20 12:11:11 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-04-29 11:33:12 +0200
commit9a66123182a64083b5f8606dcdd7963e48b90d62 (patch)
tree091cfda25ad9da8255df7091ab4d8fe2efdffbf1 /net/strparser/strparser.c
parent346ba2f22107ad3aa6769cf4abcf564bea920e41 (diff)
strparser: Do not call mod_delayed_work with a timeout of LONG_MAX
[ Upstream commit 7c5aba211dd61f41d737a2c51729eb9fdcd3edf4 ] 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 <tj@kernel.org> Signed-off-by: Doron Roberts-Kedes <doronrk@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/strparser/strparser.c')
-rw-r--r--net/strparser/strparser.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/strparser/strparser.c b/net/strparser/strparser.c
index 4a3a3f1331ee..6b5a7fffc62c 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);
}