aboutsummaryrefslogtreecommitdiff
path: root/net/netfilter/nfnetlink_cthelper.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2018-02-01 12:02:34 +0800
committerAlex Shi <alex.shi@linaro.org>2018-02-01 12:02:34 +0800
commita40f2a595adfe0be6ced06fdb4c4a24ae3291a91 (patch)
tree4e99ec8bd3ce134bdbafd54a0fc873f11c33e21b /net/netfilter/nfnetlink_cthelper.c
parent293c379504006b5ea8b4e7109ba4ebc3211f9b91 (diff)
parent49fe90b853dfb1087d0a734cd7f4af1aa00c8e53 (diff)
Merge tag 'v4.4.114' into linux-linaro-lsk-v4.4lsk-v4.4-18.02
This is the 4.4.114 stable release
Diffstat (limited to 'net/netfilter/nfnetlink_cthelper.c')
-rw-r--r--net/netfilter/nfnetlink_cthelper.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c
index 8d34a488efc0..ac143ae4f7b6 100644
--- a/net/netfilter/nfnetlink_cthelper.c
+++ b/net/netfilter/nfnetlink_cthelper.c
@@ -17,6 +17,7 @@
#include <linux/types.h>
#include <linux/list.h>
#include <linux/errno.h>
+#include <linux/capability.h>
#include <net/netlink.h>
#include <net/sock.h>
@@ -392,6 +393,9 @@ nfnl_cthelper_new(struct sock *nfnl, struct sk_buff *skb,
struct nfnl_cthelper *nlcth;
int ret = 0;
+ if (!capable(CAP_NET_ADMIN))
+ return -EPERM;
+
if (!tb[NFCTH_NAME] || !tb[NFCTH_TUPLE])
return -EINVAL;
@@ -595,6 +599,9 @@ nfnl_cthelper_get(struct sock *nfnl, struct sk_buff *skb,
struct nfnl_cthelper *nlcth;
bool tuple_set = false;
+ if (!capable(CAP_NET_ADMIN))
+ return -EPERM;
+
if (nlh->nlmsg_flags & NLM_F_DUMP) {
struct netlink_dump_control c = {
.dump = nfnl_cthelper_dump_table,
@@ -661,6 +668,9 @@ nfnl_cthelper_del(struct sock *nfnl, struct sk_buff *skb,
struct nfnl_cthelper *nlcth, *n;
int j = 0, ret;
+ if (!capable(CAP_NET_ADMIN))
+ return -EPERM;
+
if (tb[NFCTH_NAME])
helper_name = nla_data(tb[NFCTH_NAME]);