netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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>
Subject: Re: [PATCH nf] netfilter: nft_limit: fix divded by zero panic
Date: Tue, 4 Oct 2016 08:59:37 +0200	[thread overview]
Message-ID: <20161004065937.GA13178@salvia> (raw)
In-Reply-To: <1474980559-4104-1-git-send-email-zlpnobody@163.com>

On Tue, Sep 27, 2016 at 08:49:19PM +0800, Liping Zhang wrote:
> From: Liping Zhang <liping.zhang@spreadtrum.com>
> 
> After I input the following nftables rule, a panic happened on my system:
>   # nft add rule filter OUTPUT limit rate 0xf00000000 bytes/second
> 
>   divide error: 0000 [#1] SMP
>   [ ... ]
>   RIP: 0010:[<ffffffffa059035e>]  [<ffffffffa059035e>]
>   nft_limit_pkt_bytes_eval+0x2e/0xa0 [nft_limit]
>   Call Trace:
>   [<ffffffffa05721bb>] nft_do_chain+0xfb/0x4e0 [nf_tables]
>   [<ffffffffa044f236>] ? nf_nat_setup_info+0x96/0x480 [nf_nat]
>   [<ffffffff81753767>] ? ipt_do_table+0x327/0x610
>   [<ffffffffa044f677>] ? __nf_nat_alloc_null_binding+0x57/0x80 [nf_nat]
>   [<ffffffffa058b21f>] nft_ipv4_output+0xaf/0xd0 [nf_tables_ipv4]
>   [<ffffffff816f4aa2>] nf_iterate+0x62/0x80
>   [<ffffffff816f4b33>] nf_hook_slow+0x73/0xd0
>   [<ffffffff81703d0d>] __ip_local_out+0xcd/0xe0
>   [<ffffffff81701d90>] ? ip_forward_options+0x1b0/0x1b0
>   [<ffffffff81703d3c>] ip_local_out+0x1c/0x40
> 
> This is because divisor is 64-bit, but we treat it as a 32-bit integer,
> then 0xf00000000 becomes zero, i.e. divisor becomes 0.

Applied, thanks!

      reply	other threads:[~2016-10-04  6:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-27 12:49 [PATCH nf] netfilter: nft_limit: fix divded by zero panic Liping Zhang
2016-10-04  6:59 ` 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=20161004065937.GA13178@salvia \
    --to=pablo@netfilter.org \
    --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).