[NET]: Avoid copying writable clones in tunnel drivers
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Родитель
4839c52b01
Коммит
cfbba49d80
|
@ -809,7 +809,8 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
|
||||
max_headroom = LL_RESERVED_SPACE(tdev) + gre_hlen;
|
||||
|
||||
if (skb_headroom(skb) < max_headroom || skb_cloned(skb) || skb_shared(skb)) {
|
||||
if (skb_headroom(skb) < max_headroom || skb_shared(skb)||
|
||||
(skb_cloned(skb) && !skb_clone_writable(skb, 0))) {
|
||||
struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom);
|
||||
if (!new_skb) {
|
||||
ip_rt_put(rt);
|
||||
|
|
|
@ -595,7 +595,8 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
*/
|
||||
max_headroom = (LL_RESERVED_SPACE(tdev)+sizeof(struct iphdr));
|
||||
|
||||
if (skb_headroom(skb) < max_headroom || skb_cloned(skb) || skb_shared(skb)) {
|
||||
if (skb_headroom(skb) < max_headroom || skb_shared(skb) ||
|
||||
(skb_cloned(skb) && !skb_clone_writable(skb, 0))) {
|
||||
struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom);
|
||||
if (!new_skb) {
|
||||
ip_rt_put(rt);
|
||||
|
|
|
@ -883,8 +883,8 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
|
|||
*/
|
||||
max_headroom += LL_RESERVED_SPACE(tdev);
|
||||
|
||||
if (skb_headroom(skb) < max_headroom ||
|
||||
skb_cloned(skb) || skb_shared(skb)) {
|
||||
if (skb_headroom(skb) < max_headroom || skb_shared(skb) ||
|
||||
(skb_cloned(skb) && !skb_clone_writable(skb, 0))) {
|
||||
struct sk_buff *new_skb;
|
||||
|
||||
if (!(new_skb = skb_realloc_headroom(skb, max_headroom)))
|
||||
|
|
|
@ -532,7 +532,8 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
*/
|
||||
max_headroom = LL_RESERVED_SPACE(tdev)+sizeof(struct iphdr);
|
||||
|
||||
if (skb_headroom(skb) < max_headroom || skb_cloned(skb) || skb_shared(skb)) {
|
||||
if (skb_headroom(skb) < max_headroom || skb_shared(skb) ||
|
||||
(skb_cloned(skb) && !skb_clone_writable(skb, 0))) {
|
||||
struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom);
|
||||
if (!new_skb) {
|
||||
ip_rt_put(rt);
|
||||
|
|
Загрузка…
Ссылка в новой задаче