ipv4: ip_check_defrag must not modify skb before unsharing
authorJohannes Berg <johannes.berg@intel.com>
Sun, 9 Dec 2012 23:41:06 +0000 (23:41 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Dec 2012 17:27:18 +0000 (09:27 -0800)
commitf410b53608cc49ab1d6bdfd36e7843f851ae1d3b
tree902f6ed8ce5ffffce83852328c92d57ca4c9966f
parent67e248587152f3976ab9277a48442dbec1ac6fdd
ipv4: ip_check_defrag must not modify skb before unsharing

[ Upstream commit 1bf3751ec90cc3174e01f0d701e8449ce163d113 ]

ip_check_defrag() might be called from af_packet within the
RX path where shared SKBs are used, so it must not modify
the input SKB before it has unshared it for defragmentation.
Use skb_copy_bits() to get the IP header and only pull in
everything later.

The same is true for the other caller in macvlan as it is
called from dev->rx_handler which can also get a shared SKB.

Reported-by: Eric Leblond <eric@regit.org>
Cc: stable@vger.kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv4/ip_fragment.c