Antoine Tenart 9eeabdf17f net: fix a memleak when uncloning an skb dst and its metadata
When uncloning an skb dst and its associated metadata, a new
dst+metadata is allocated and later replaces the old one in the skb.
This is helpful to have a non-shared dst+metadata attached to a specific
skb.

The issue is the uncloned dst+metadata is initialized with a refcount of
1, which is increased to 2 before attaching it to the skb. When
tun_dst_unclone returns, the dst+metadata is only referenced from a
single place (the skb) while its refcount is 2. Its refcount will never
drop to 0 (when the skb is consumed), leading to a memory leak.

Fix this by removing the call to dst_hold in tun_dst_unclone, as the
dst+metadata refcount is already 1.

Fixes: fc4099f17240 ("openvswitch: Fix egress tunnel info.")
Cc: Pravin B Shelar <pshelar@ovn.org>
Reported-by: Vlad Buslov <vladbu@nvidia.com>
Tested-by: Vlad Buslov <vladbu@nvidia.com>
Signed-off-by: Antoine Tenart <atenart@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-02-09 11:41:47 +00:00
..
2022-01-10 10:00:09 +09:00
2021-07-01 13:19:48 -07:00
2022-01-04 12:40:22 +00:00
2021-06-11 13:32:46 -07:00
2021-11-01 13:36:09 +00:00
2021-08-03 11:50:22 +01:00
2021-12-06 16:26:46 -08:00
2021-10-13 09:40:46 -07:00
2021-10-13 09:40:46 -07:00
2020-05-05 13:23:29 -07:00
2021-12-16 07:18:35 -08:00
2019-12-09 10:36:44 -08:00
2021-12-06 16:26:46 -08:00
2020-06-22 21:12:44 -07:00
2021-10-15 11:33:08 +01:00
2021-11-19 20:09:55 -08:00
2021-10-13 09:40:46 -07:00
2021-07-27 13:05:56 +01:00
2019-12-09 10:36:44 -08:00
2022-01-05 19:46:32 -08:00
2020-03-04 13:25:55 -08:00
2021-05-17 15:29:35 -07:00
2021-10-13 09:40:45 -07:00
2021-08-04 10:01:26 +01:00
2019-04-22 21:47:25 -07:00
2019-10-05 16:29:00 -07:00
2021-08-03 13:05:26 +01:00
2020-06-18 20:46:23 -07:00
2019-12-09 10:28:43 -08:00
2021-09-28 00:18:35 +02:00