Fix double-free: NF_HOOK sometimes frees the sk_buff passed in.
authorBen Pfaff <blp@nicira.com>
Thu, 13 Nov 2008 19:29:20 +0000 (11:29 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 13 Nov 2008 20:45:38 +0000 (12:45 -0800)
commitad27c8ac82007a09fbb302c0993b2c8746311a3d
treeb0f8d15fa829351e8463b51b78828f35dc244666
parent2d82ee4e58e302353c3bf67cbb846f86a28b84a8
Fix double-free: NF_HOOK sometimes frees the sk_buff passed in.

NF_HOOK is supposed to *always* consume the sk_buff passed in, either
internally or through the okfn argument.  We assumed that it never
consumed its sk_buff, which was OK in the case where it called okfn,
since our okfn (snat_pre_route_finish) never freed its sk_buff, but
not when one of the netfilter hooks dropped or stole the packet, because
then we'd assume that it still existed and free it a second time.

The other users of NF_HOOK in this file, in snat_skb() and
snat_skb_finish(), do not need to be fixed because they always pass a
copy of their sk_buff argument to NF_HOOK and expect it to be freed.
datapath/datapath.c
datapath/nx_act_snat.c