diff options
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r-- | drivers/net/tun.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 3d443597bd04..db16d7a13e00 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1599,7 +1599,8 @@ static bool tun_can_build_skb(struct tun_struct *tun, struct tun_file *tfile, | |||
1599 | return true; | 1599 | return true; |
1600 | } | 1600 | } |
1601 | 1601 | ||
1602 | static struct sk_buff *__tun_build_skb(struct page_frag *alloc_frag, char *buf, | 1602 | static struct sk_buff *__tun_build_skb(struct tun_file *tfile, |
1603 | struct page_frag *alloc_frag, char *buf, | ||
1603 | int buflen, int len, int pad) | 1604 | int buflen, int len, int pad) |
1604 | { | 1605 | { |
1605 | struct sk_buff *skb = build_skb(buf, buflen); | 1606 | struct sk_buff *skb = build_skb(buf, buflen); |
@@ -1609,6 +1610,7 @@ static struct sk_buff *__tun_build_skb(struct page_frag *alloc_frag, char *buf, | |||
1609 | 1610 | ||
1610 | skb_reserve(skb, pad); | 1611 | skb_reserve(skb, pad); |
1611 | skb_put(skb, len); | 1612 | skb_put(skb, len); |
1613 | skb_set_owner_w(skb, tfile->socket.sk); | ||
1612 | 1614 | ||
1613 | get_page(alloc_frag->page); | 1615 | get_page(alloc_frag->page); |
1614 | alloc_frag->offset += buflen; | 1616 | alloc_frag->offset += buflen; |
@@ -1686,7 +1688,8 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun, | |||
1686 | */ | 1688 | */ |
1687 | if (hdr->gso_type || !xdp_prog) { | 1689 | if (hdr->gso_type || !xdp_prog) { |
1688 | *skb_xdp = 1; | 1690 | *skb_xdp = 1; |
1689 | return __tun_build_skb(alloc_frag, buf, buflen, len, pad); | 1691 | return __tun_build_skb(tfile, alloc_frag, buf, buflen, len, |
1692 | pad); | ||
1690 | } | 1693 | } |
1691 | 1694 | ||
1692 | *skb_xdp = 0; | 1695 | *skb_xdp = 0; |
@@ -1723,7 +1726,7 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun, | |||
1723 | rcu_read_unlock(); | 1726 | rcu_read_unlock(); |
1724 | local_bh_enable(); | 1727 | local_bh_enable(); |
1725 | 1728 | ||
1726 | return __tun_build_skb(alloc_frag, buf, buflen, len, pad); | 1729 | return __tun_build_skb(tfile, alloc_frag, buf, buflen, len, pad); |
1727 | 1730 | ||
1728 | err_xdp: | 1731 | err_xdp: |
1729 | put_page(alloc_frag->page); | 1732 | put_page(alloc_frag->page); |