diff options
author | Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> | 2006-02-04 05:12:14 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-02-05 02:51:17 -0500 |
commit | ddc8d029ac6813827849801bce2d8c8813070db6 (patch) | |
tree | f0ae3607018873a8ed3594b9d81f155aed75b906 /include/net | |
parent | 34f9a2e4deb760ddcb94cd0cd4f9ce18070d53d9 (diff) |
[NETFILTER]: nf_conntrack: check address family when finding protocol module
__nf_conntrack_{l3}proto_find() doesn't check the passed protocol family,
then it's possible to touch out of the array which has only AF_MAX items.
Spotted by Pablo Neira Ayuso.
Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/netfilter/nf_conntrack_l3proto.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h index 67856eb93b43..dac43b15a5b0 100644 --- a/include/net/netfilter/nf_conntrack_l3proto.h +++ b/include/net/netfilter/nf_conntrack_l3proto.h | |||
@@ -88,12 +88,6 @@ extern struct nf_conntrack_l3proto *nf_ct_l3protos[AF_MAX]; | |||
88 | extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); | 88 | extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); |
89 | extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto); | 89 | extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto); |
90 | 90 | ||
91 | static inline struct nf_conntrack_l3proto * | ||
92 | __nf_ct_l3proto_find(u_int16_t l3proto) | ||
93 | { | ||
94 | return nf_ct_l3protos[l3proto]; | ||
95 | } | ||
96 | |||
97 | extern struct nf_conntrack_l3proto * | 91 | extern struct nf_conntrack_l3proto * |
98 | nf_ct_l3proto_find_get(u_int16_t l3proto); | 92 | nf_ct_l3proto_find_get(u_int16_t l3proto); |
99 | 93 | ||
@@ -103,4 +97,13 @@ extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p); | |||
103 | extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4; | 97 | extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4; |
104 | extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6; | 98 | extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6; |
105 | extern struct nf_conntrack_l3proto nf_conntrack_generic_l3proto; | 99 | extern struct nf_conntrack_l3proto nf_conntrack_generic_l3proto; |
100 | |||
101 | static inline struct nf_conntrack_l3proto * | ||
102 | __nf_ct_l3proto_find(u_int16_t l3proto) | ||
103 | { | ||
104 | if (unlikely(l3proto >= AF_MAX)) | ||
105 | return &nf_conntrack_generic_l3proto; | ||
106 | return nf_ct_l3protos[l3proto]; | ||
107 | } | ||
108 | |||
106 | #endif /*_NF_CONNTRACK_L3PROTO_H*/ | 109 | #endif /*_NF_CONNTRACK_L3PROTO_H*/ |