From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: syzkaller-bugs@googlegroups.com, Florian Westphal <fw@strlen.de>
Subject: [PATCH nf] netfilter: nf_nat: range size must be at least 1
Date: Tue, 13 Feb 2018 01:45:53 +0100 [thread overview]
Message-ID: <20180213004553.20083-1-fw@strlen.de> (raw)
In-Reply-To: <001a114528768857060565072942@google.com>
divide error: 0000 [#1] SMP KASAN
RIP: 0010:nf_nat_l4proto_unique_tuple+0x291/0x530
net/netfilter/nf_nat_proto_common.c:88
looks like a day 0 bug.
Avoid this by forcing a min_range of 1.
Reported-by: <syzbot+8012e198bd037f4871e5@syzkaller.appspotmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/netfilter/nf_nat_proto_common.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/netfilter/nf_nat_proto_common.c b/net/netfilter/nf_nat_proto_common.c
index fbce552a796e..2d1fc3722ed2 100644
--- a/net/netfilter/nf_nat_proto_common.c
+++ b/net/netfilter/nf_nat_proto_common.c
@@ -72,6 +72,8 @@ void nf_nat_l4proto_unique_tuple(const struct nf_nat_l3proto *l3proto,
} else {
min = ntohs(range->min_proto.all);
range_size = ntohs(range->max_proto.all) - min + 1;
+ if (range_size == 0)
+ range_size = 1;
}
if (range->flags & NF_NAT_RANGE_PROTO_RANDOM) {
--
2.13.6
prev parent reply other threads:[~2018-02-13 0:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-12 17:25 divide error in nf_nat_l4proto_unique_tuple syzbot
2018-02-13 0:45 ` Florian Westphal [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=20180213004553.20083-1-fw@strlen.de \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.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).