]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - include/linux/rcupdate.h
Merge tag 'powerpc-spectre-rsb' of powerpc-CVE-2019-18660.bundle
[linux.git] / include / linux / rcupdate.h
index 75a2eded7aa2ce6973622ecfd5a2a00772f07270..0b7506330c87dc1df106c78ddb09b4dca9172864 100644 (file)
@@ -210,7 +210,7 @@ static inline void rcu_lock_acquire(struct lockdep_map *map)
 
 static inline void rcu_lock_release(struct lockdep_map *map)
 {
-       lock_release(map, 1, _THIS_IP_);
+       lock_release(map, _THIS_IP_);
 }
 
 extern struct lockdep_map rcu_lock_map;
@@ -382,6 +382,24 @@ do {                                                                             \
                smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \
 } while (0)
 
+/**
+ * rcu_replace_pointer() - replace an RCU pointer, returning its old value
+ * @rcu_ptr: RCU pointer, whose old value is returned
+ * @ptr: regular pointer
+ * @c: the lockdep conditions under which the dereference will take place
+ *
+ * Perform a replacement, where @rcu_ptr is an RCU-annotated
+ * pointer and @c is the lockdep argument that is passed to the
+ * rcu_dereference_protected() call used to read that pointer.  The old
+ * value of @rcu_ptr is returned, and @rcu_ptr is set to @ptr.
+ */
+#define rcu_replace_pointer(rcu_ptr, ptr, c)                           \
+({                                                                     \
+       typeof(ptr) __tmp = rcu_dereference_protected((rcu_ptr), (c));  \
+       rcu_assign_pointer((rcu_ptr), (ptr));                           \
+       __tmp;                                                          \
+})
+
 /**
  * rcu_swap_protected() - swap an RCU and a regular pointer
  * @rcu_ptr: RCU pointer