Jiri Benc 8a226b2cfa ipv6: prevent race between address creation and removal
There's a race in IPv6 automatic addess assignment. The address is created
with zero lifetime when it's added to various address lists. Before it gets
assigned the correct lifetime, there's a window where a new address may be
configured. This causes the semi-initiated address to be deleted in
addrconf_verify.

This was discovered as a reference leak caused by concurrent run of
__ipv6_ifa_notify for both RTM_NEWADDR and RTM_DELADDR with the same
address.

Fix this by setting the lifetime before the address is added to
inet6_addr_lst.

A few notes:

1. In addrconf_prefix_rcv, by setting update_lft to zero, the
   if (update_lft) { ... } condition is no longer executed for newly
   created addresses. This is okay, as the ifp fields are set in
   ipv6_add_addr now and ipv6_ifa_notify is called (and has been called)
   through addrconf_dad_start.

2. The removal of the whole block under ifp->lock in inet6_addr_add is okay,
   too, as tstamp is initialized to jiffies in ipv6_add_addr.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-08-01 14:16:20 -07:00
..
2013-02-15 15:10:37 -05:00
2012-11-03 14:59:05 -04:00
2013-05-27 22:50:59 -07:00
2013-03-26 12:27:18 -04:00
2013-03-26 12:27:19 -04:00
2013-08-01 14:16:20 -07:00
2013-05-31 16:26:49 -07:00
2013-07-04 14:55:47 -07:00
2013-03-17 14:35:13 -04:00
2013-07-10 17:08:27 -07:00
2013-05-11 16:26:38 -07:00
2013-07-10 17:08:27 -07:00
2013-05-11 16:26:38 -07:00
2012-11-01 12:41:35 -04:00