]> git.baikalelectronics.ru Git - kernel.git/commit
ipv6: properly prevent temp_prefered_lft sysctl race
authorJiri Bohac <jbohac@suse.cz>
Thu, 20 Oct 2016 10:29:26 +0000 (12:29 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 20 Oct 2016 18:29:11 +0000 (14:29 -0400)
commita7fc22dce1b1fd0359d514da2a0aee54e2c04562
tree296d579460ec8de98617fd4c63945f4cf4db2aae
parente897ad63592adcfe0eaf2b0abf1fa1619cf20f09
ipv6: properly prevent temp_prefered_lft sysctl race

The check for an underflow of tmp_prefered_lft is always false
because tmp_prefered_lft is unsigned. The intention of the check
was to guard against racing with an update of the
temp_prefered_lft sysctl, potentially resulting in an underflow.

As suggested by David Miller, the best way to prevent the race is
by reading the sysctl variable using READ_ONCE.

Signed-off-by: Jiri Bohac <jbohac@suse.cz>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Fixes: e614c2a4a0d2 ("IPv6: fix DESYNC_FACTOR")
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/addrconf.c