linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tim Hansen <devtimhansen@gmail.com>
To: viro@zeniv.linux.org.uk
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	devtimhansen@gmail.com
Subject: [PATCH] fs: Safe rcu access to hlist.
Date: Sun, 19 Nov 2017 15:02:10 -0500	[thread overview]
Message-ID: <20171119200210.hhrklgm6hxhoyhqh@debian> (raw)

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@gmail.com>
---
 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

             reply	other threads:[~2017-11-19 20:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-19 20:02 Tim Hansen [this message]
2017-11-19 21:28 ` [PATCH] fs: Safe rcu access to hlist Al Viro
2017-11-20 18:55   ` Tim Hansen
2017-11-20 20:01     ` Luc Van Oostenryck
2017-11-20 20:42       ` Matthew Wilcox
2017-11-20 20:58         ` Luc Van Oostenryck
2017-11-20 21:21           ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171119200210.hhrklgm6hxhoyhqh@debian \
    --to=devtimhansen@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).