Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[IPSEC]: Make x->lastused an unsigned long

Currently x->lastused is u64 which means that it cannot be
read/written atomically on all architectures. David Miller observed
that the value stored in it is only an unsigned long which is always
atomic.

So based on his suggestion this patch changes the internal
representation from u64 to unsigned long while the user-interface
still refers to it as u64.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Herbert Xu and committed by
David S. Miller
d26f3984 0ebea8ef

+3 -5
+1 -1
include/net/xfrm.h
··· 183 183 struct timer_list timer; 184 184 185 185 /* Last used time */ 186 - u64 lastused; 186 + unsigned long lastused; 187 187 188 188 /* Reference to data common to all the instances of this 189 189 * transformer. */
-2
net/ipv6/xfrm6_mode_ro.c
··· 54 54 __skb_pull(skb, hdr_len); 55 55 memmove(ipv6_hdr(skb), iph, hdr_len); 56 56 57 - spin_lock_bh(&x->lock); 58 57 x->lastused = get_seconds(); 59 - spin_unlock_bh(&x->lock); 60 58 61 59 return 0; 62 60 }
+2 -2
net/xfrm/xfrm_user.c
··· 1986 1986 if (x->coaddr) 1987 1987 l += nla_total_size(sizeof(*x->coaddr)); 1988 1988 1989 - /* Must count this as this may become non-zero behind our back. */ 1990 - l += nla_total_size(sizeof(x->lastused)); 1989 + /* Must count x->lastused as it may become non-zero behind our back. */ 1990 + l += nla_total_size(sizeof(u64)); 1991 1991 1992 1992 return l; 1993 1993 }