* [PATCH 1/2] netfilter: ipset: fix netiface set name overflow
@ 2012-11-22 11:32 Florian Westphal
2012-11-22 11:32 ` [PATCH 2/2] netfilter: nla_policy updates Florian Westphal
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Florian Westphal @ 2012-11-22 11:32 UTC (permalink / raw)
To: netfilter-devel; +Cc: Florian Westphal
attribute is copied to IFNAMSIZ-size stack variable,
but IFNAMSIZ is smaller than IPSET_MAXNAMELEN.
Fortunately nfnetlink needs CAP_NET_ADMIN.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/netfilter/ipset/ip_set_hash_netiface.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/netfilter/ipset/ip_set_hash_netiface.c b/net/netfilter/ipset/ip_set_hash_netiface.c
index b9a6338..45a1014 100644
--- a/net/netfilter/ipset/ip_set_hash_netiface.c
+++ b/net/netfilter/ipset/ip_set_hash_netiface.c
@@ -793,7 +793,7 @@ static struct ip_set_type hash_netiface_type __read_mostly = {
[IPSET_ATTR_IP] = { .type = NLA_NESTED },
[IPSET_ATTR_IP_TO] = { .type = NLA_NESTED },
[IPSET_ATTR_IFACE] = { .type = NLA_NUL_STRING,
- .len = IPSET_MAXNAMELEN - 1 },
+ .len = IFNAMSIZ - 1 },
[IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 },
[IPSET_ATTR_CIDR] = { .type = NLA_U8 },
[IPSET_ATTR_TIMEOUT] = { .type = NLA_U32 },
--
1.7.8.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] netfilter: nla_policy updates
2012-11-22 11:32 [PATCH 1/2] netfilter: ipset: fix netiface set name overflow Florian Westphal
@ 2012-11-22 11:32 ` Florian Westphal
2012-12-03 18:27 ` Pablo Neira Ayuso
2012-11-22 20:42 ` [PATCH 1/2] netfilter: ipset: fix netiface set name overflow Jozsef Kadlecsik
2012-11-24 23:02 ` Pablo Neira Ayuso
2 siblings, 1 reply; 5+ messages in thread
From: Florian Westphal @ 2012-11-22 11:32 UTC (permalink / raw)
To: netfilter-devel; +Cc: Florian Westphal
Add stricter checking for a few attributes.
Note that these changes don't fix any bug in the current code base.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
Sending these patches separate, so you
could add the first (bug fix) to net and this one to -next.
In case you would like to apply both to the same
tree, feel free to squash them into a single commit.
net/netfilter/nf_conntrack_netlink.c | 8 ++++++--
net/netfilter/nf_conntrack_proto_tcp.c | 2 ++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 7bbfb3d..4f41128 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -898,7 +898,8 @@ ctnetlink_parse_zone(const struct nlattr *attr, u16 *zone)
}
static const struct nla_policy help_nla_policy[CTA_HELP_MAX+1] = {
- [CTA_HELP_NAME] = { .type = NLA_NUL_STRING },
+ [CTA_HELP_NAME] = { .type = NLA_NUL_STRING,
+ .len = NF_CT_HELPER_NAME_LEN - 1 },
};
static inline int
@@ -932,6 +933,8 @@ static const struct nla_policy ct_nla_policy[CTA_MAX+1] = {
[CTA_ID] = { .type = NLA_U32 },
[CTA_NAT_DST] = { .type = NLA_NESTED },
[CTA_TUPLE_MASTER] = { .type = NLA_NESTED },
+ [CTA_NAT_SEQ_ADJ_ORIG] = { .type = NLA_NESTED },
+ [CTA_NAT_SEQ_ADJ_REPLY] = { .type = NLA_NESTED },
[CTA_ZONE] = { .type = NLA_U16 },
[CTA_MARK_MASK] = { .type = NLA_U32 },
};
@@ -2216,7 +2219,8 @@ static const struct nla_policy exp_nla_policy[CTA_EXPECT_MAX+1] = {
[CTA_EXPECT_MASK] = { .type = NLA_NESTED },
[CTA_EXPECT_TIMEOUT] = { .type = NLA_U32 },
[CTA_EXPECT_ID] = { .type = NLA_U32 },
- [CTA_EXPECT_HELP_NAME] = { .type = NLA_NUL_STRING },
+ [CTA_EXPECT_HELP_NAME] = { .type = NLA_NUL_STRING,
+ .len = NF_CT_HELPER_NAME_LEN - 1 },
[CTA_EXPECT_ZONE] = { .type = NLA_U16 },
[CTA_EXPECT_FLAGS] = { .type = NLA_U32 },
[CTA_EXPECT_CLASS] = { .type = NLA_U32 },
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index 61f9285..83876e9 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -1353,6 +1353,8 @@ static const struct nla_policy tcp_timeout_nla_policy[CTA_TIMEOUT_TCP_MAX+1] = {
[CTA_TIMEOUT_TCP_TIME_WAIT] = { .type = NLA_U32 },
[CTA_TIMEOUT_TCP_CLOSE] = { .type = NLA_U32 },
[CTA_TIMEOUT_TCP_SYN_SENT2] = { .type = NLA_U32 },
+ [CTA_TIMEOUT_TCP_RETRANS] = { .type = NLA_U32 },
+ [CTA_TIMEOUT_TCP_UNACK] = { .type = NLA_U32 },
};
#endif /* CONFIG_NF_CT_NETLINK_TIMEOUT */
--
1.7.8.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] netfilter: ipset: fix netiface set name overflow
2012-11-22 11:32 [PATCH 1/2] netfilter: ipset: fix netiface set name overflow Florian Westphal
2012-11-22 11:32 ` [PATCH 2/2] netfilter: nla_policy updates Florian Westphal
@ 2012-11-22 20:42 ` Jozsef Kadlecsik
2012-11-24 23:02 ` Pablo Neira Ayuso
2 siblings, 0 replies; 5+ messages in thread
From: Jozsef Kadlecsik @ 2012-11-22 20:42 UTC (permalink / raw)
To: Florian Westphal, Pablo Neira Ayuso; +Cc: netfilter-devel
Hi Florian,
On Thu, 22 Nov 2012, Florian Westphal wrote:
> attribute is copied to IFNAMSIZ-size stack variable,
> but IFNAMSIZ is smaller than IPSET_MAXNAMELEN.
>
> Fortunately nfnetlink needs CAP_NET_ADMIN.
Good catch! Pablo, the patch should be applied to the -stable tree down to
3.2.x.
Acked-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Best regards,
Jozsef
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
> net/netfilter/ipset/ip_set_hash_netiface.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/netfilter/ipset/ip_set_hash_netiface.c b/net/netfilter/ipset/ip_set_hash_netiface.c
> index b9a6338..45a1014 100644
> --- a/net/netfilter/ipset/ip_set_hash_netiface.c
> +++ b/net/netfilter/ipset/ip_set_hash_netiface.c
> @@ -793,7 +793,7 @@ static struct ip_set_type hash_netiface_type __read_mostly = {
> [IPSET_ATTR_IP] = { .type = NLA_NESTED },
> [IPSET_ATTR_IP_TO] = { .type = NLA_NESTED },
> [IPSET_ATTR_IFACE] = { .type = NLA_NUL_STRING,
> - .len = IPSET_MAXNAMELEN - 1 },
> + .len = IFNAMSIZ - 1 },
> [IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 },
> [IPSET_ATTR_CIDR] = { .type = NLA_U8 },
> [IPSET_ATTR_TIMEOUT] = { .type = NLA_U32 },
> --
> 1.7.8.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
-
E-mail : kadlec@blackhole.kfki.hu, kadlecsik.jozsef@wigner.mta.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
H-1525 Budapest 114, POB. 49, Hungary
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] netfilter: ipset: fix netiface set name overflow
2012-11-22 11:32 [PATCH 1/2] netfilter: ipset: fix netiface set name overflow Florian Westphal
2012-11-22 11:32 ` [PATCH 2/2] netfilter: nla_policy updates Florian Westphal
2012-11-22 20:42 ` [PATCH 1/2] netfilter: ipset: fix netiface set name overflow Jozsef Kadlecsik
@ 2012-11-24 23:02 ` Pablo Neira Ayuso
2 siblings, 0 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2012-11-24 23:02 UTC (permalink / raw)
To: Florian Westphal; +Cc: netfilter-devel, Jozsef Kadlecsik
On Thu, Nov 22, 2012 at 12:32:45PM +0100, Florian Westphal wrote:
> attribute is copied to IFNAMSIZ-size stack variable,
> but IFNAMSIZ is smaller than IPSET_MAXNAMELEN.
>
> Fortunately nfnetlink needs CAP_NET_ADMIN.
Good. Applied, thanks Florian.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] netfilter: nla_policy updates
2012-11-22 11:32 ` [PATCH 2/2] netfilter: nla_policy updates Florian Westphal
@ 2012-12-03 18:27 ` Pablo Neira Ayuso
0 siblings, 0 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2012-12-03 18:27 UTC (permalink / raw)
To: Florian Westphal; +Cc: netfilter-devel
On Thu, Nov 22, 2012 at 12:32:46PM +0100, Florian Westphal wrote:
> Add stricter checking for a few attributes.
> Note that these changes don't fix any bug in the current code base.
Applied, thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-12-03 18:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-22 11:32 [PATCH 1/2] netfilter: ipset: fix netiface set name overflow Florian Westphal
2012-11-22 11:32 ` [PATCH 2/2] netfilter: nla_policy updates Florian Westphal
2012-12-03 18:27 ` Pablo Neira Ayuso
2012-11-22 20:42 ` [PATCH 1/2] netfilter: ipset: fix netiface set name overflow Jozsef Kadlecsik
2012-11-24 23:02 ` Pablo Neira Ayuso
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).