]> git.baikalelectronics.ru Git - kernel.git/commit
macvlan: Fix potential use-after free for broadcasts
authorHerbert Xu <herbert@gondor.apana.org.au>
Wed, 1 Jun 2016 03:43:00 +0000 (11:43 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 2 Jun 2016 00:48:46 +0000 (17:48 -0700)
commit02334e9325a82dae83bcebc021c633093fd6a2f9
treef3d2d75d159a68ee886d04cd130d05107f388bbd
parentb4d16e21ca7772fb3f30ed653da552220b35e9be
macvlan: Fix potential use-after free for broadcasts

When we postpone a broadcast packet we save the source port in
the skb if it is local.  However, the source port can disappear
before we get a chance to process the packet.

This patch fixes this by holding a ref count on the netdev.

It also delays the skb->cb modification until after we allocate
the new skb as you should not modify shared skbs.

Fixes: 57d86229cc90 ("macvlan: Move broadcasts into a work queue")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/macvlan.c