OSDN Git Service

netfilter: x_tables: add and use xt_check_proc_name
authorFlorian Westphal <fw@strlen.de>
Sat, 10 Mar 2018 00:15:45 +0000 (01:15 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 8 Apr 2018 09:51:59 +0000 (11:51 +0200)
commit9aaaa409c5c3b985fce81a6dfd662d60b2fc1ee5
treeae00204075d7914bd76c868f5221b70f8d89bdff
parenteaa0e4e1b93e4e16fa771cb8ca1eaa0b47a30452
netfilter: x_tables: add and use xt_check_proc_name

commit b1d0a5d0cba4597c0394997b2d5fced3e3841b4e upstream.

recent and hashlimit both create /proc files, but only check that
name is 0 terminated.

This can trigger WARN() from procfs when name is "" or "/".
Add helper for this and then use it for both.

Cc: Eric Dumazet <eric.dumazet@gmail.com>
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Reported-by: <syzbot+0502b00edac2a0680b61@syzkaller.appspotmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/netfilter/x_tables.h
net/netfilter/x_tables.c
net/netfilter/xt_hashlimit.c
net/netfilter/xt_recent.c