netfilter: nf_ct_sip: Use mod_timer_pending()
authorGao Feng <fgao@ikuai8.com>
Thu, 9 Feb 2017 08:46:45 +0000 (16:46 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sun, 12 Feb 2017 13:39:06 +0000 (14:39 +0100)
timer_del() followed by timer_add() can be replaced by
mod_timer_pending().

Signed-off-by: Gao Feng <fgao@ikuai8.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_conntrack_sip.c

index c3fc14e021ecf55ba9085cd7ee7a86bfc5352750..24174c5202398fa28287db69b570a12db15c1771 100644 (file)
@@ -809,13 +809,11 @@ static int refresh_signalling_expectation(struct nf_conn *ct,
                    exp->tuple.dst.protonum != proto ||
                    exp->tuple.dst.u.udp.port != port)
                        continue;
-               if (!del_timer(&exp->timeout))
-                       continue;
-               exp->flags &= ~NF_CT_EXPECT_INACTIVE;
-               exp->timeout.expires = jiffies + expires * HZ;
-               add_timer(&exp->timeout);
-               found = 1;
-               break;
+               if (mod_timer_pending(&exp->timeout, jiffies + expires * HZ)) {
+                       exp->flags &= ~NF_CT_EXPECT_INACTIVE;
+                       found = 1;
+                       break;
+               }
        }
        spin_unlock_bh(&nf_conntrack_expect_lock);
        return found;