Florian Westphal
542fbda0f0
netfilter: nat: can't use dst_hold on noref dst
...
The dst entry might already have a zero refcount, waiting on rcu list
to be free'd. Using dst_hold() transitions its reference count to 1, and
next dst release will try to free it again -- resulting in a double free:
WARNING: CPU: 1 PID: 0 at include/net/dst.h:239 nf_xfrm_me_harder+0xe7/0x130 [nf_nat]
RIP: 0010:nf_xfrm_me_harder+0xe7/0x130 [nf_nat]
Code: 48 8b 5c 24 60 65 48 33 1c 25 28 00 00 00 75 53 48 83 c4 68 5b 5d 41 5c c3 85 c0 74 0d 8d 48 01 f0 0f b1 0a 74 86 85 c0 75 f3 <0f> 0b e9 7b ff ff ff 29 c6 31 d2 b9 20 00 48 00 4c 89 e7 e8 31 27
Call Trace:
nf_nat_ipv4_out+0x78/0x90 [nf_nat_ipv4]
nf_hook_slow+0x36/0xd0
ip_output+0x9f/0xd0
ip_forward+0x328/0x440
ip_rcv+0x8a/0xb0
Use dst_hold_safe instead and bail out if we cannot take a reference.
Fixes: a4c2fd7f7891 ("net: remove DST_NOCACHE flag")
Reported-by: Martin Zaharinov <micron10@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2018-12-13 00:58:22 +01:00
..
2018-07-06 12:32:12 +02:00
2018-11-03 10:35:52 -07:00
2018-10-19 17:01:43 -07:00
2018-06-28 10:40:47 -07:00
2018-10-23 10:57:06 -07:00
2018-07-24 14:10:42 -07:00
2018-11-12 10:41:29 +01:00
2018-11-01 19:58:52 -07:00
2018-10-19 13:49:34 -07:00
2018-10-22 19:37:36 -07:00
2018-11-17 21:38:44 -08:00
2018-10-23 10:57:06 -07:00
2018-11-09 17:19:34 +01:00
2018-11-19 17:59:47 +01:00
2018-11-29 11:06:08 -08:00
2018-07-27 13:17:50 -07:00
2018-10-23 10:57:06 -07:00
2018-09-21 19:48:36 -07:00
2018-10-04 09:40:52 -07:00
2018-11-30 17:17:39 -08:00
2018-06-26 11:33:04 +09:00
2018-09-21 19:45:52 -07:00
2018-11-30 17:22:41 -08:00
2018-11-28 11:02:45 -08:00
2018-10-23 10:57:06 -07:00
2018-09-17 18:43:42 -07:00
2018-07-27 09:33:37 -07:00
2018-11-14 22:49:31 -08:00
2018-10-22 19:59:20 -07:00
2018-10-12 13:05:40 +02:00
2018-09-28 12:46:07 +08:00
2018-10-16 00:14:07 -07:00
2018-10-17 22:14:54 -07:00
2018-12-13 00:58:22 +01:00
2018-09-21 18:58:34 -07:00
2018-10-16 00:13:12 -07:00
2018-06-28 10:40:47 -07:00
2018-10-24 14:43:41 +01:00
2018-07-12 16:55:29 -07:00
2018-11-30 13:18:09 -08:00
2018-11-23 11:08:03 -08:00
2018-06-28 10:40:47 -07:00
2018-07-05 20:20:03 +09:00
2018-10-12 21:38:46 -07:00
2018-09-04 21:33:03 -07:00
2018-06-28 10:40:47 -07:00
2018-11-15 11:35:40 -08:00
2018-11-30 17:14:06 -08:00
2018-11-30 13:12:43 -08:00
2018-11-21 16:14:56 -08:00
2018-10-15 12:23:19 -07:00
2018-11-15 10:59:37 -06:00
2018-11-27 16:30:39 -08:00
2018-11-01 19:58:52 -07:00
2018-10-23 10:57:06 -07:00
2018-08-07 12:39:13 -07:00
2018-07-24 14:10:42 -07:00
2018-10-12 12:56:34 +02:00
2018-11-29 14:25:36 -08:00
2018-10-19 11:03:06 -07:00
2018-11-03 18:25:17 -07:00
2018-08-29 15:42:24 +02:00
2018-10-15 12:23:19 -07:00
2018-06-28 13:36:39 +09:00
2018-11-17 21:34:11 -08:00