mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-11-30 15:53:22 -05:00
ipv6: prevent a possible race condition with lifetimes
[ Upstream commit 6c0d8833a605e195ae219b5042577ce52bf71fff ] valid_lft, prefered_lft and tstamp are always accessed under the lock "lock" in other places. Reading these without taking the lock may result in inconsistencies regarding the calculation of the valid and preferred variables since decisions are taken on these fields for those variables. Signed-off-by: Niels Dossche <[email protected]> Reviewed-by: David Ahern <[email protected]> Signed-off-by: Niels Dossche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
1d4bdaaa8d
commit
090e73fb9c
1 changed files with 2 additions and 0 deletions
|
|
@ -4924,6 +4924,7 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa,
|
|||
nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid))
|
||||
goto error;
|
||||
|
||||
spin_lock_bh(&ifa->lock);
|
||||
if (!((ifa->flags&IFA_F_PERMANENT) &&
|
||||
(ifa->prefered_lft == INFINITY_LIFE_TIME))) {
|
||||
preferred = ifa->prefered_lft;
|
||||
|
|
@ -4945,6 +4946,7 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa,
|
|||
preferred = INFINITY_LIFE_TIME;
|
||||
valid = INFINITY_LIFE_TIME;
|
||||
}
|
||||
spin_unlock_bh(&ifa->lock);
|
||||
|
||||
if (!ipv6_addr_any(&ifa->peer_addr)) {
|
||||
if (nla_put_in6_addr(skb, IFA_LOCAL, &ifa->addr) < 0 ||
|
||||
|
|
|
|||
Loading…
Reference in a new issue