提交 46ba5a25 编写于 作者: K Krishna Kumar 提交者: Pablo Neira Ayuso

netfilter: nfnetlink_queue: do not allow to set unsupported flag bits

Allow setting of only supported flag bits in queue->flags.
Signed-off-by: NKrishna Kumar <krkumar2@in.ibm.com>
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
上级 59560a38
...@@ -95,5 +95,6 @@ enum nfqnl_attr_config { ...@@ -95,5 +95,6 @@ enum nfqnl_attr_config {
/* Flags for NFQA_CFG_FLAGS */ /* Flags for NFQA_CFG_FLAGS */
#define NFQA_CFG_F_FAIL_OPEN (1 << 0) #define NFQA_CFG_F_FAIL_OPEN (1 << 0)
#define NFQA_CFG_F_CONNTRACK (1 << 1) #define NFQA_CFG_F_CONNTRACK (1 << 1)
#define NFQA_CFG_F_MAX (1 << 2)
#endif /* _NFNETLINK_QUEUE_H */ #endif /* _NFNETLINK_QUEUE_H */
...@@ -910,6 +910,11 @@ nfqnl_recv_config(struct sock *ctnl, struct sk_buff *skb, ...@@ -910,6 +910,11 @@ nfqnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
flags = ntohl(nla_get_be32(nfqa[NFQA_CFG_FLAGS])); flags = ntohl(nla_get_be32(nfqa[NFQA_CFG_FLAGS]));
mask = ntohl(nla_get_be32(nfqa[NFQA_CFG_MASK])); mask = ntohl(nla_get_be32(nfqa[NFQA_CFG_MASK]));
if (flags >= NFQA_CFG_F_MAX) {
ret = -EOPNOTSUPP;
goto err_out_unlock;
}
spin_lock_bh(&queue->lock); spin_lock_bh(&queue->lock);
queue->flags &= ~mask; queue->flags &= ~mask;
queue->flags |= flags & mask; queue->flags |= flags & mask;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册