diff options
-rw-r--r-- | drivers/net/ppp/pppoe.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c index 4e1da1645b15..5aa59f41bf8c 100644 --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c | |||
@@ -842,6 +842,7 @@ static int pppoe_sendmsg(struct socket *sock, struct msghdr *m, | |||
842 | struct pppoe_hdr *ph; | 842 | struct pppoe_hdr *ph; |
843 | struct net_device *dev; | 843 | struct net_device *dev; |
844 | char *start; | 844 | char *start; |
845 | int hlen; | ||
845 | 846 | ||
846 | lock_sock(sk); | 847 | lock_sock(sk); |
847 | if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) { | 848 | if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) { |
@@ -860,16 +861,16 @@ static int pppoe_sendmsg(struct socket *sock, struct msghdr *m, | |||
860 | if (total_len > (dev->mtu + dev->hard_header_len)) | 861 | if (total_len > (dev->mtu + dev->hard_header_len)) |
861 | goto end; | 862 | goto end; |
862 | 863 | ||
863 | 864 | hlen = LL_RESERVED_SPACE(dev); | |
864 | skb = sock_wmalloc(sk, total_len + dev->hard_header_len + 32, | 865 | skb = sock_wmalloc(sk, hlen + sizeof(*ph) + total_len + |
865 | 0, GFP_KERNEL); | 866 | dev->needed_tailroom, 0, GFP_KERNEL); |
866 | if (!skb) { | 867 | if (!skb) { |
867 | error = -ENOMEM; | 868 | error = -ENOMEM; |
868 | goto end; | 869 | goto end; |
869 | } | 870 | } |
870 | 871 | ||
871 | /* Reserve space for headers. */ | 872 | /* Reserve space for headers. */ |
872 | skb_reserve(skb, dev->hard_header_len); | 873 | skb_reserve(skb, hlen); |
873 | skb_reset_network_header(skb); | 874 | skb_reset_network_header(skb); |
874 | 875 | ||
875 | skb->dev = dev; | 876 | skb->dev = dev; |
@@ -930,7 +931,7 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb) | |||
930 | /* Copy the data if there is no space for the header or if it's | 931 | /* Copy the data if there is no space for the header or if it's |
931 | * read-only. | 932 | * read-only. |
932 | */ | 933 | */ |
933 | if (skb_cow_head(skb, sizeof(*ph) + dev->hard_header_len)) | 934 | if (skb_cow_head(skb, LL_RESERVED_SPACE(dev) + sizeof(*ph))) |
934 | goto abort; | 935 | goto abort; |
935 | 936 | ||
936 | __skb_push(skb, sizeof(*ph)); | 937 | __skb_push(skb, sizeof(*ph)); |