[PATCH] fs: Safe rcu access to hlist.

From: Tim Hansen
Date: Sun Nov 19 2017 - 15:02:25 EST


Adds hlist_first_rcu and hlist_next_rcu for safe access
to the hlist in seq_hlist_next_rcu.

Found on linux-next branch, tag next-20171117 with sparse.

Signed-off-by: Tim Hansen <devtimhansen@xxxxxxxxx>
---
fs/seq_file.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/seq_file.c b/fs/seq_file.c
index fb17f35a49a6..0b966781fd60 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -968,9 +968,9 @@ struct hlist_node *seq_hlist_next_rcu(void *v,

++*ppos;
if (v == SEQ_START_TOKEN)
- return rcu_dereference(head->first);
+ return rcu_dereference(hlist_first_rcu(head));
else
- return rcu_dereference(node->next);
+ return rcu_dereference(hlist_next_rcu(node));
}
EXPORT_SYMBOL(seq_hlist_next_rcu);

--
2.15.0.rc0