diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-09-17 00:14:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-09-17 00:14:54 -0400 |
commit | edb1e9671a990e6eb9f593636deed7ac43ba9084 (patch) | |
tree | 1b8b592411d9d7e4321479f57cb6d1f38ec483e3 /include | |
parent | fa890d586cc127ce72597ba0a909bfecf784e10c (diff) | |
parent | d9f30ec0b0d129b9cbf2b041a6a3159aa24592f6 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
[VLAN]: Fix net_device leak.
[PPP] generic: Fix receive path data clobbering & non-linear handling
[PPP] generic: Call skb_cow_head before scribbling over skb
[NET] skbuff: Add skb_cow_head
[BRIDGE]: Kill clone argument to br_flood_*
[PPP] pppoe: Fill in header directly in __pppoe_xmit
[PPP] pppoe: Fix data clobbering in __pppoe_xmit and return value
[PPP] pppoe: Fix skb_unshare_check call position
[SCTP]: Convert bind_addr_list locking to RCU
[SCTP]: Add RCU synchronization around sctp_localaddr_list
[PKT_SCHED]: sch_cbq.c: Shut up uninitialized variable warning
[PKTGEN]: srcmac fix
[IPV6]: Fix source address selection.
[IPV4]: Just increment OutDatagrams once per a datagram.
[IPV6]: Just increment OutDatagrams once per a datagram.
[IPV6]: Fix unbalanced socket reference with MSG_CONFIRM.
[NET_SCHED] protect action config/dump from irqs
[NET]: Fix two issues wrt. SO_BINDTODEVICE.
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/skbuff.h | 40 | ||||
-rw-r--r-- | include/net/sctp/sctp.h | 1 | ||||
-rw-r--r-- | include/net/sctp/structs.h | 13 |
3 files changed, 41 insertions, 13 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 93c27f71122a..a656cecd373c 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -1352,6 +1352,22 @@ static inline int skb_clone_writable(struct sk_buff *skb, int len) | |||
1352 | skb_headroom(skb) + len <= skb->hdr_len; | 1352 | skb_headroom(skb) + len <= skb->hdr_len; |
1353 | } | 1353 | } |
1354 | 1354 | ||
1355 | static inline int __skb_cow(struct sk_buff *skb, unsigned int headroom, | ||
1356 | int cloned) | ||
1357 | { | ||
1358 | int delta = 0; | ||
1359 | |||
1360 | if (headroom < NET_SKB_PAD) | ||
1361 | headroom = NET_SKB_PAD; | ||
1362 | if (headroom > skb_headroom(skb)) | ||
1363 | delta = headroom - skb_headroom(skb); | ||
1364 | |||
1365 | if (delta || cloned) | ||
1366 | return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD), 0, | ||
1367 | GFP_ATOMIC); | ||
1368 | return 0; | ||
1369 | } | ||
1370 | |||
1355 | /** | 1371 | /** |
1356 | * skb_cow - copy header of skb when it is required | 1372 | * skb_cow - copy header of skb when it is required |
1357 | * @skb: buffer to cow | 1373 | * @skb: buffer to cow |
@@ -1366,16 +1382,22 @@ static inline int skb_clone_writable(struct sk_buff *skb, int len) | |||
1366 | */ | 1382 | */ |
1367 | static inline int skb_cow(struct sk_buff *skb, unsigned int headroom) | 1383 | static inline int skb_cow(struct sk_buff *skb, unsigned int headroom) |
1368 | { | 1384 | { |
1369 | int delta = (headroom > NET_SKB_PAD ? headroom : NET_SKB_PAD) - | 1385 | return __skb_cow(skb, headroom, skb_cloned(skb)); |
1370 | skb_headroom(skb); | 1386 | } |
1371 | |||
1372 | if (delta < 0) | ||
1373 | delta = 0; | ||
1374 | 1387 | ||
1375 | if (delta || skb_cloned(skb)) | 1388 | /** |
1376 | return pskb_expand_head(skb, (delta + (NET_SKB_PAD-1)) & | 1389 | * skb_cow_head - skb_cow but only making the head writable |
1377 | ~(NET_SKB_PAD-1), 0, GFP_ATOMIC); | 1390 | * @skb: buffer to cow |
1378 | return 0; | 1391 | * @headroom: needed headroom |
1392 | * | ||
1393 | * This function is identical to skb_cow except that we replace the | ||
1394 | * skb_cloned check by skb_header_cloned. It should be used when | ||
1395 | * you only need to push on some header and do not need to modify | ||
1396 | * the data. | ||
1397 | */ | ||
1398 | static inline int skb_cow_head(struct sk_buff *skb, unsigned int headroom) | ||
1399 | { | ||
1400 | return __skb_cow(skb, headroom, skb_header_cloned(skb)); | ||
1379 | } | 1401 | } |
1380 | 1402 | ||
1381 | /** | 1403 | /** |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index d529045c1679..c9cc00c85782 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -123,6 +123,7 @@ | |||
123 | * sctp/protocol.c | 123 | * sctp/protocol.c |
124 | */ | 124 | */ |
125 | extern struct sock *sctp_get_ctl_sock(void); | 125 | extern struct sock *sctp_get_ctl_sock(void); |
126 | extern void sctp_local_addr_free(struct rcu_head *head); | ||
126 | extern int sctp_copy_local_addr_list(struct sctp_bind_addr *, | 127 | extern int sctp_copy_local_addr_list(struct sctp_bind_addr *, |
127 | sctp_scope_t, gfp_t gfp, | 128 | sctp_scope_t, gfp_t gfp, |
128 | int flags); | 129 | int flags); |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index c0d5848c33dc..c2fe2dcc9afc 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -207,6 +207,9 @@ extern struct sctp_globals { | |||
207 | * It is a list of sctp_sockaddr_entry. | 207 | * It is a list of sctp_sockaddr_entry. |
208 | */ | 208 | */ |
209 | struct list_head local_addr_list; | 209 | struct list_head local_addr_list; |
210 | |||
211 | /* Lock that protects the local_addr_list writers */ | ||
212 | spinlock_t addr_list_lock; | ||
210 | 213 | ||
211 | /* Flag to indicate if addip is enabled. */ | 214 | /* Flag to indicate if addip is enabled. */ |
212 | int addip_enable; | 215 | int addip_enable; |
@@ -242,6 +245,7 @@ extern struct sctp_globals { | |||
242 | #define sctp_port_alloc_lock (sctp_globals.port_alloc_lock) | 245 | #define sctp_port_alloc_lock (sctp_globals.port_alloc_lock) |
243 | #define sctp_port_hashtable (sctp_globals.port_hashtable) | 246 | #define sctp_port_hashtable (sctp_globals.port_hashtable) |
244 | #define sctp_local_addr_list (sctp_globals.local_addr_list) | 247 | #define sctp_local_addr_list (sctp_globals.local_addr_list) |
248 | #define sctp_local_addr_lock (sctp_globals.addr_list_lock) | ||
245 | #define sctp_addip_enable (sctp_globals.addip_enable) | 249 | #define sctp_addip_enable (sctp_globals.addip_enable) |
246 | #define sctp_prsctp_enable (sctp_globals.prsctp_enable) | 250 | #define sctp_prsctp_enable (sctp_globals.prsctp_enable) |
247 | 251 | ||
@@ -737,8 +741,10 @@ const union sctp_addr *sctp_source(const struct sctp_chunk *chunk); | |||
737 | /* This is a structure for holding either an IPv6 or an IPv4 address. */ | 741 | /* This is a structure for holding either an IPv6 or an IPv4 address. */ |
738 | struct sctp_sockaddr_entry { | 742 | struct sctp_sockaddr_entry { |
739 | struct list_head list; | 743 | struct list_head list; |
744 | struct rcu_head rcu; | ||
740 | union sctp_addr a; | 745 | union sctp_addr a; |
741 | __u8 use_as_src; | 746 | __u8 use_as_src; |
747 | __u8 valid; | ||
742 | }; | 748 | }; |
743 | 749 | ||
744 | typedef struct sctp_chunk *(sctp_packet_phandler_t)(struct sctp_association *); | 750 | typedef struct sctp_chunk *(sctp_packet_phandler_t)(struct sctp_association *); |
@@ -1149,7 +1155,9 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest, | |||
1149 | int flags); | 1155 | int flags); |
1150 | int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, | 1156 | int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, |
1151 | __u8 use_as_src, gfp_t gfp); | 1157 | __u8 use_as_src, gfp_t gfp); |
1152 | int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); | 1158 | int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *, |
1159 | void (*rcu_call)(struct rcu_head *, | ||
1160 | void (*func)(struct rcu_head *))); | ||
1153 | int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, | 1161 | int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, |
1154 | struct sctp_sock *); | 1162 | struct sctp_sock *); |
1155 | union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, | 1163 | union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, |
@@ -1220,9 +1228,6 @@ struct sctp_ep_common { | |||
1220 | * bind_addr.address_list is our set of local IP addresses. | 1228 | * bind_addr.address_list is our set of local IP addresses. |
1221 | */ | 1229 | */ |
1222 | struct sctp_bind_addr bind_addr; | 1230 | struct sctp_bind_addr bind_addr; |
1223 | |||
1224 | /* Protection during address list comparisons. */ | ||
1225 | rwlock_t addr_lock; | ||
1226 | }; | 1231 | }; |
1227 | 1232 | ||
1228 | 1233 | ||