]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 10 May 2020 08:26:36 +0000 (10:26 +0200)
commit26f2a93b7c688eb7dc1d1c8ae4cf64f451d62fbd
tree8373390c9950d40ffbb1b70efcc14e4d95c18f5a
parent69101271ba86aca3202c5ff746e0666f900added
macvlan: Fix potential use-after free for broadcasts

commit 260916dfb48c374f7840f3b86e69afd3afdb6e96 upstream.

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: 412ca1550cbe ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/macvlan.c