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.
This commit is contained in:
+31
-9
@@ -1352,6 +1352,22 @@ static inline int skb_clone_writable(struct sk_buff *skb, int len)
|
||||
skb_headroom(skb) + len <= skb->hdr_len;
|
||||
}
|
||||
|
||||
static inline int __skb_cow(struct sk_buff *skb, unsigned int headroom,
|
||||
int cloned)
|
||||
{
|
||||
int delta = 0;
|
||||
|
||||
if (headroom < NET_SKB_PAD)
|
||||
headroom = NET_SKB_PAD;
|
||||
if (headroom > skb_headroom(skb))
|
||||
delta = headroom - skb_headroom(skb);
|
||||
|
||||
if (delta || cloned)
|
||||
return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD), 0,
|
||||
GFP_ATOMIC);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* skb_cow - copy header of skb when it is required
|
||||
* @skb: buffer to cow
|
||||
@@ -1366,16 +1382,22 @@ static inline int skb_clone_writable(struct sk_buff *skb, int len)
|
||||
*/
|
||||
static inline int skb_cow(struct sk_buff *skb, unsigned int headroom)
|
||||
{
|
||||
int delta = (headroom > NET_SKB_PAD ? headroom : NET_SKB_PAD) -
|
||||
skb_headroom(skb);
|
||||
return __skb_cow(skb, headroom, skb_cloned(skb));
|
||||
}
|
||||
|
||||
if (delta < 0)
|
||||
delta = 0;
|
||||
|
||||
if (delta || skb_cloned(skb))
|
||||
return pskb_expand_head(skb, (delta + (NET_SKB_PAD-1)) &
|
||||
~(NET_SKB_PAD-1), 0, GFP_ATOMIC);
|
||||
return 0;
|
||||
/**
|
||||
* skb_cow_head - skb_cow but only making the head writable
|
||||
* @skb: buffer to cow
|
||||
* @headroom: needed headroom
|
||||
*
|
||||
* This function is identical to skb_cow except that we replace the
|
||||
* skb_cloned check by skb_header_cloned. It should be used when
|
||||
* you only need to push on some header and do not need to modify
|
||||
* the data.
|
||||
*/
|
||||
static inline int skb_cow_head(struct sk_buff *skb, unsigned int headroom)
|
||||
{
|
||||
return __skb_cow(skb, headroom, skb_header_cloned(skb));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user