From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Liping Zhang <zlpnobody@163.com>
Cc: netfilter-devel@vger.kernel.org,
Liping Zhang <liping.zhang@spreadtrum.com>,
Gao Feng <fgao@ikuai8.com>
Subject: Re: [PATCH nf-next] netfilter: nf_ct_h323: do not re-activate already expired timer
Date: Mon, 8 Aug 2016 13:07:20 +0200 [thread overview]
Message-ID: <20160808110720.GA4796@salvia> (raw)
In-Reply-To: <1469283416-25879-1-git-send-email-zlpnobody@163.com>
On Sat, Jul 23, 2016 at 10:16:56PM +0800, Liping Zhang wrote:
> From: Liping Zhang <liping.zhang@spreadtrum.com>
>
> Commit 96d1327ac2e3 ("netfilter: h323: Use mod_timer instead of
> set_expect_timeout") just simplify the source codes
> if (!del_timer(&exp->timeout))
> return 0;
> add_timer(&exp->timeout);
> to mod_timer(&exp->timeout, jiffies + info->timeout * HZ);
>
> This is not correct, and introduce a race codition:
> CPU0 CPU1
> - timer expire
> process_rcf expectation_timed_out
> lock(exp_lock) -
> find_exp waiting exp_lock...
> re-activate timer!! waiting exp_lock...
> unlock(exp_lock) lock(exp_lock)
> - unlink expect
> - free(expect)
> - unlock(exp_lock)
> So when the timer expires again, we will access the memory that
> was already freed.
>
> Replace mod_timer with mod_timer_pending here to fix this problem.
>
> Fixes: 96d1327ac2e3 ("netfilter: h323: Use mod_timer instead of set_expect_timeout")
Applied, thanks Zhang.
prev parent reply other threads:[~2016-08-08 11:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-23 14:16 [PATCH nf-next] netfilter: nf_ct_h323: do not re-activate already expired timer Liping Zhang
2016-08-08 11:07 ` Pablo Neira Ayuso [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160808110720.GA4796@salvia \
--to=pablo@netfilter.org \
--cc=fgao@ikuai8.com \
--cc=liping.zhang@spreadtrum.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=zlpnobody@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).