]> git.baikalelectronics.ru Git - kernel.git/commitdiff
tipc: Fix recognition of trial period
authorMark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
Mon, 10 Oct 2022 02:46:13 +0000 (15:46 +1300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 14 Oct 2022 07:17:52 +0000 (08:17 +0100)
The trial period exists until jiffies is after addr_trial_end. But as
jiffies will eventually overflow, just using time_after will eventually
give incorrect results. As the node address is set once the trial period
ends, this can be used to know that we are not in the trial period.

Fixes: 1e610648044f ("tipc: correct discovery message handling during address trial period")
Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/discover.c

index da69e1abf68ff7359c9b9918014eafd58ab73da1..e8630707901e379b83068df89137e2d7330bed2f 100644 (file)
@@ -148,8 +148,8 @@ static bool tipc_disc_addr_trial_msg(struct tipc_discoverer *d,
 {
        struct net *net = d->net;
        struct tipc_net *tn = tipc_net(net);
-       bool trial = time_before(jiffies, tn->addr_trial_end);
        u32 self = tipc_own_addr(net);
+       bool trial = time_before(jiffies, tn->addr_trial_end) && !self;
 
        if (mtyp == DSC_TRIAL_FAIL_MSG) {
                if (!trial)