diff options
| author | Jason Wang <[email protected]> | 2017-10-27 03:05:44 +0000 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2017-10-28 10:05:28 +0000 |
| commit | 63b9ab65bd76e5de6479bb14b4014b64aa1a317a (patch) | |
| tree | 3822be64ed1349f2d394198b022fe482ddaa47e7 | |
| parent | Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirshe... (diff) | |
| download | kernel-63b9ab65bd76e5de6479bb14b4014b64aa1a317a.tar.gz kernel-63b9ab65bd76e5de6479bb14b4014b64aa1a317a.zip | |
tuntap: properly align skb->head before building skb
An unaligned alloc_frag->offset caused by previous allocation will
result an unaligned skb->head. This will lead unaligned
skb_shared_info and then unaligned dataref which requires to be
aligned for accessing on some architecture. Fix this by aligning
alloc_frag->offset before the frag refilling.
Fixes: 0bbd7dad34f8 ("tun: make tun_build_skb() thread safe")
Cc: Eric Dumazet <[email protected]>
Cc: Willem de Bruijn <[email protected]>
Cc: Wei Wei <[email protected]>
Cc: Dmitry Vyukov <[email protected]>
Cc: Mark Rutland <[email protected]>
Reported-by: Wei Wei <[email protected]>
Signed-off-by: Jason Wang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
| -rw-r--r-- | drivers/net/tun.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index b9973fb868b7..5550f56cb895 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1286,6 +1286,7 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun, buflen += SKB_DATA_ALIGN(len + pad); rcu_read_unlock(); + alloc_frag->offset = ALIGN((u64)alloc_frag->offset, SMP_CACHE_BYTES); if (unlikely(!skb_page_frag_refill(buflen, alloc_frag, GFP_KERNEL))) return ERR_PTR(-ENOMEM); |
