diff options
| author | Jan Engelhardt <jengelh@medozas.de> | 2011-01-06 22:15:05 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2011-01-09 19:25:03 -0500 |
| commit | 0ab03c2b1478f2438d2c80204f7fef65b1bca9cf (patch) | |
| tree | a130abc7a3cc2d5c326b1bbdad80c06e741db3fd | |
| parent | dba5a68ae147d0672d4b9259f3ece37777f8b2fa (diff) | |
netlink: test for all flags of the NLM_F_DUMP composite
Due to NLM_F_DUMP is composed of two bits, NLM_F_ROOT | NLM_F_MATCH,
when doing "if (x & NLM_F_DUMP)", it tests for _either_ of the bits
being set. Because NLM_F_MATCH's value overlaps with NLM_F_EXCL,
non-dump requests with NLM_F_EXCL set are mistaken as dump requests.
Substitute the condition to test for _all_ bits being set.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | net/core/rtnetlink.c | 2 | ||||
| -rw-r--r-- | net/ipv4/inet_diag.c | 2 | ||||
| -rw-r--r-- | net/netfilter/nf_conntrack_netlink.c | 4 | ||||
| -rw-r--r-- | net/netlink/genetlink.c | 2 | ||||
| -rw-r--r-- | net/xfrm/xfrm_user.c | 2 |
5 files changed, 6 insertions, 6 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 750db57f3bb..a5f7535aab5 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
| @@ -1820,7 +1820,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
| 1820 | if (kind != 2 && security_netlink_recv(skb, CAP_NET_ADMIN)) | 1820 | if (kind != 2 && security_netlink_recv(skb, CAP_NET_ADMIN)) |
| 1821 | return -EPERM; | 1821 | return -EPERM; |
| 1822 | 1822 | ||
| 1823 | if (kind == 2 && nlh->nlmsg_flags&NLM_F_DUMP) { | 1823 | if (kind == 2 && (nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP) { |
| 1824 | struct sock *rtnl; | 1824 | struct sock *rtnl; |
| 1825 | rtnl_dumpit_func dumpit; | 1825 | rtnl_dumpit_func dumpit; |
| 1826 | 1826 | ||
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 2ada17129fc..2746c1fa641 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
| @@ -858,7 +858,7 @@ static int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
| 858 | nlmsg_len(nlh) < hdrlen) | 858 | nlmsg_len(nlh) < hdrlen) |
| 859 | return -EINVAL; | 859 | return -EINVAL; |
| 860 | 860 | ||
| 861 | if (nlh->nlmsg_flags & NLM_F_DUMP) { | 861 | if ((nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP) { |
| 862 | if (nlmsg_attrlen(nlh, hdrlen)) { | 862 | if (nlmsg_attrlen(nlh, hdrlen)) { |
| 863 | struct nlattr *attr; | 863 | struct nlattr *attr; |
| 864 | 864 | ||
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 0cdba50c0d6..746140264b2 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
| @@ -928,7 +928,7 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb, | |||
| 928 | u16 zone; | 928 | u16 zone; |
| 929 | int err; | 929 | int err; |
| 930 | 930 | ||
| 931 | if (nlh->nlmsg_flags & NLM_F_DUMP) | 931 | if ((nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP) |
| 932 | return netlink_dump_start(ctnl, skb, nlh, ctnetlink_dump_table, | 932 | return netlink_dump_start(ctnl, skb, nlh, ctnetlink_dump_table, |
| 933 | ctnetlink_done); | 933 | ctnetlink_done); |
| 934 | 934 | ||
| @@ -1790,7 +1790,7 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb, | |||
| 1790 | u16 zone; | 1790 | u16 zone; |
| 1791 | int err; | 1791 | int err; |
| 1792 | 1792 | ||
| 1793 | if (nlh->nlmsg_flags & NLM_F_DUMP) { | 1793 | if ((nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP) { |
| 1794 | return netlink_dump_start(ctnl, skb, nlh, | 1794 | return netlink_dump_start(ctnl, skb, nlh, |
| 1795 | ctnetlink_exp_dump_table, | 1795 | ctnetlink_exp_dump_table, |
| 1796 | ctnetlink_exp_done); | 1796 | ctnetlink_exp_done); |
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 1781d99145e..f83cb370292 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
| @@ -519,7 +519,7 @@ static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
| 519 | security_netlink_recv(skb, CAP_NET_ADMIN)) | 519 | security_netlink_recv(skb, CAP_NET_ADMIN)) |
| 520 | return -EPERM; | 520 | return -EPERM; |
| 521 | 521 | ||
| 522 | if (nlh->nlmsg_flags & NLM_F_DUMP) { | 522 | if ((nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP) { |
| 523 | if (ops->dumpit == NULL) | 523 | if (ops->dumpit == NULL) |
| 524 | return -EOPNOTSUPP; | 524 | return -EOPNOTSUPP; |
| 525 | 525 | ||
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 8eb88951091..6a8da81ff66 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
| @@ -2187,7 +2187,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
| 2187 | 2187 | ||
| 2188 | if ((type == (XFRM_MSG_GETSA - XFRM_MSG_BASE) || | 2188 | if ((type == (XFRM_MSG_GETSA - XFRM_MSG_BASE) || |
| 2189 | type == (XFRM_MSG_GETPOLICY - XFRM_MSG_BASE)) && | 2189 | type == (XFRM_MSG_GETPOLICY - XFRM_MSG_BASE)) && |
| 2190 | (nlh->nlmsg_flags & NLM_F_DUMP)) { | 2190 | (nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP) { |
| 2191 | if (link->dump == NULL) | 2191 | if (link->dump == NULL) |
| 2192 | return -EINVAL; | 2192 | return -EINVAL; |
| 2193 | 2193 | ||
