aboutsummaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorMichel Machado <michel@digirati.com.br>2012-04-10 14:07:40 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2012-04-24 20:54:49 -0700
commitf88022a4f650ac1778cafcc17d2e522283bdf590 (patch)
tree650a2185c949330002bb4dce090f3257f2779ee6 /init
parent559f9badd11ddf399f88b18b4c0f110fd511ae53 (diff)
rcu: Replace list_first_entry_rcu() with list_first_or_null_rcu()
The list_first_entry_rcu() macro is inherently unsafe because it cannot be applied to an empty list. But because RCU readers do not exclude updaters, a list might become empty between the time that list_empty() claimed it was non-empty and the time that list_first_entry_rcu() is invoked. Therefore, the list_empty() test cannot be separated from the list_first_entry_rcu() call. This commit therefore combines these to macros to create a new list_first_or_null_rcu() macro that replaces the old (and unsafe) list_first_entry_rcu() macro. This patch incorporates Paul's review comments on the previous version of this patch available here: https://lkml.org/lkml/2012/4/2/536 This patch cannot break any upstream code because list_first_entry_rcu() is not being used anywhere in the kernel (tested with grep(1)), and any external code using it is probably broken as a result of using it. Signed-off-by: Michel Machado <michel@digirati.com.br> CC: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> CC: Dipankar Sarma <dipankar@in.ibm.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'init')
0 files changed, 0 insertions, 0 deletions