Commit 2918cd81f58aa9748acf961240c006394f474047
Exists in
master
and in
7 other branches
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: [NETFILTER] arp_tables: Fix unaligned accesses. [IPV6] SNMP: Fix {In,Out}NoRoutes statistics. [IPSEC] XFRM_USER: kernel panic when large security contexts in ACQUIRE [VLAN]: Allow VLAN interface on top of bridge interface [PKTGEN]: Add try_to_freeze() [NETFILTER]: ipt_ULOG: use put_unaligned
Showing 6 changed files Side-by-side Diff
net/8021q/vlan_dev.c
net/core/pktgen.c
... | ... | @@ -129,6 +129,7 @@ |
129 | 129 | #include <linux/ioport.h> |
130 | 130 | #include <linux/interrupt.h> |
131 | 131 | #include <linux/capability.h> |
132 | +#include <linux/freezer.h> | |
132 | 133 | #include <linux/delay.h> |
133 | 134 | #include <linux/timer.h> |
134 | 135 | #include <linux/list.h> |
... | ... | @@ -3332,6 +3333,8 @@ |
3332 | 3333 | pktgen_rem_one_if(t); |
3333 | 3334 | t->control &= ~(T_REMDEV); |
3334 | 3335 | } |
3336 | + | |
3337 | + try_to_freeze(); | |
3335 | 3338 | |
3336 | 3339 | set_current_state(TASK_INTERRUPTIBLE); |
3337 | 3340 | } |
net/ipv4/netfilter/arp_tables.c
... | ... | @@ -166,13 +166,9 @@ |
166 | 166 | return 0; |
167 | 167 | } |
168 | 168 | |
169 | - for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) { | |
170 | - unsigned long odev; | |
171 | - memcpy(&odev, outdev + i*sizeof(unsigned long), | |
172 | - sizeof(unsigned long)); | |
173 | - ret |= (odev | |
174 | - ^ ((const unsigned long *)arpinfo->outiface)[i]) | |
175 | - & ((const unsigned long *)arpinfo->outiface_mask)[i]; | |
169 | + for (i = 0, ret = 0; i < IFNAMSIZ; i++) { | |
170 | + ret |= (outdev[i] ^ arpinfo->outiface[i]) | |
171 | + & arpinfo->outiface_mask[i]; | |
176 | 172 | } |
177 | 173 | |
178 | 174 | if (FWINV(ret != 0, ARPT_INV_VIA_OUT)) { |
net/ipv4/netfilter/ipt_ULOG.c
... | ... | @@ -61,6 +61,7 @@ |
61 | 61 | #include <linux/netfilter_ipv4/ipt_ULOG.h> |
62 | 62 | #include <net/sock.h> |
63 | 63 | #include <linux/bitops.h> |
64 | +#include <asm/unaligned.h> | |
64 | 65 | |
65 | 66 | MODULE_LICENSE("GPL"); |
66 | 67 | MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); |
... | ... | @@ -236,9 +237,9 @@ |
236 | 237 | |
237 | 238 | /* copy hook, prefix, timestamp, payload, etc. */ |
238 | 239 | pm->data_len = copy_len; |
239 | - pm->timestamp_sec = skb->tstamp.off_sec; | |
240 | - pm->timestamp_usec = skb->tstamp.off_usec; | |
241 | - pm->mark = skb->mark; | |
240 | + put_unaligned(skb->tstamp.off_sec, &pm->timestamp_sec); | |
241 | + put_unaligned(skb->tstamp.off_usec, &pm->timestamp_usec); | |
242 | + put_unaligned(skb->mark, &pm->mark); | |
242 | 243 | pm->hook = hooknum; |
243 | 244 | if (prefix != NULL) |
244 | 245 | strncpy(pm->prefix, prefix, sizeof(pm->prefix)); |
net/ipv6/route.c
... | ... | @@ -1766,13 +1766,22 @@ |
1766 | 1766 | * Drop the packet on the floor |
1767 | 1767 | */ |
1768 | 1768 | |
1769 | -static inline int ip6_pkt_drop(struct sk_buff *skb, int code) | |
1769 | +static inline int ip6_pkt_drop(struct sk_buff *skb, int code, | |
1770 | + int ipstats_mib_noroutes) | |
1770 | 1771 | { |
1771 | - int type = ipv6_addr_type(&skb->nh.ipv6h->daddr); | |
1772 | - if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) | |
1773 | - IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS); | |
1774 | - | |
1775 | - IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_OUTNOROUTES); | |
1772 | + int type; | |
1773 | + switch (ipstats_mib_noroutes) { | |
1774 | + case IPSTATS_MIB_INNOROUTES: | |
1775 | + type = ipv6_addr_type(&skb->nh.ipv6h->daddr); | |
1776 | + if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) { | |
1777 | + IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS); | |
1778 | + break; | |
1779 | + } | |
1780 | + /* FALLTHROUGH */ | |
1781 | + case IPSTATS_MIB_OUTNOROUTES: | |
1782 | + IP6_INC_STATS(ip6_dst_idev(skb->dst), ipstats_mib_noroutes); | |
1783 | + break; | |
1784 | + } | |
1776 | 1785 | icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0, skb->dev); |
1777 | 1786 | kfree_skb(skb); |
1778 | 1787 | return 0; |
1779 | 1788 | |
1780 | 1789 | |
1781 | 1790 | |
... | ... | @@ -1780,26 +1789,26 @@ |
1780 | 1789 | |
1781 | 1790 | static int ip6_pkt_discard(struct sk_buff *skb) |
1782 | 1791 | { |
1783 | - return ip6_pkt_drop(skb, ICMPV6_NOROUTE); | |
1792 | + return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_INNOROUTES); | |
1784 | 1793 | } |
1785 | 1794 | |
1786 | 1795 | static int ip6_pkt_discard_out(struct sk_buff *skb) |
1787 | 1796 | { |
1788 | 1797 | skb->dev = skb->dst->dev; |
1789 | - return ip6_pkt_discard(skb); | |
1798 | + return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_OUTNOROUTES); | |
1790 | 1799 | } |
1791 | 1800 | |
1792 | 1801 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
1793 | 1802 | |
1794 | 1803 | static int ip6_pkt_prohibit(struct sk_buff *skb) |
1795 | 1804 | { |
1796 | - return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED); | |
1805 | + return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_INNOROUTES); | |
1797 | 1806 | } |
1798 | 1807 | |
1799 | 1808 | static int ip6_pkt_prohibit_out(struct sk_buff *skb) |
1800 | 1809 | { |
1801 | 1810 | skb->dev = skb->dst->dev; |
1802 | - return ip6_pkt_prohibit(skb); | |
1811 | + return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); | |
1803 | 1812 | } |
1804 | 1813 | |
1805 | 1814 | static int ip6_pkt_blk_hole(struct sk_buff *skb) |
net/xfrm/xfrm_user.c
... | ... | @@ -272,9 +272,8 @@ |
272 | 272 | } |
273 | 273 | |
274 | 274 | |
275 | -static inline int xfrm_user_sec_ctx_size(struct xfrm_policy *xp) | |
275 | +static inline int xfrm_user_sec_ctx_size(struct xfrm_sec_ctx *xfrm_ctx) | |
276 | 276 | { |
277 | - struct xfrm_sec_ctx *xfrm_ctx = xp->security; | |
278 | 277 | int len = 0; |
279 | 278 | |
280 | 279 | if (xfrm_ctx) { |
... | ... | @@ -2170,7 +2169,7 @@ |
2170 | 2169 | |
2171 | 2170 | len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); |
2172 | 2171 | len += NLMSG_SPACE(sizeof(struct xfrm_user_acquire)); |
2173 | - len += RTA_SPACE(xfrm_user_sec_ctx_size(xp)); | |
2172 | + len += RTA_SPACE(xfrm_user_sec_ctx_size(x->security)); | |
2174 | 2173 | #ifdef CONFIG_XFRM_SUB_POLICY |
2175 | 2174 | len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type)); |
2176 | 2175 | #endif |
... | ... | @@ -2280,7 +2279,7 @@ |
2280 | 2279 | |
2281 | 2280 | len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); |
2282 | 2281 | len += NLMSG_SPACE(sizeof(struct xfrm_user_polexpire)); |
2283 | - len += RTA_SPACE(xfrm_user_sec_ctx_size(xp)); | |
2282 | + len += RTA_SPACE(xfrm_user_sec_ctx_size(xp->security)); | |
2284 | 2283 | #ifdef CONFIG_XFRM_SUB_POLICY |
2285 | 2284 | len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type)); |
2286 | 2285 | #endif |