linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] afs: Fix missing/incorrect unlocking of RCU read lock
@ 2024-01-17 16:14 David Howells
  2024-01-17 16:21 ` David Howells
  2024-01-17 17:15 ` Alan Huang
  0 siblings, 2 replies; 4+ messages in thread
From: David Howells @ 2024-01-17 16:14 UTC (permalink / raw)
  To: Marc Dionne; +Cc: dhowells, linux-afs, linux-fsdevel, linux-kernel

In afs_proc_addr_prefs_show(), we need to unlock the RCU read lock in both
places before returning (and not lock it again).

Fixes: f94f70d39cc2 ("afs: Provide a way to configure address priorities")
Reported-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: linux-afs@lists.infradead.org
cc: linux-fsdevel@vger.kernel.org
---
 fs/afs/proc.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/afs/proc.c b/fs/afs/proc.c
index 3bd02571f30d..15eab053af6d 100644
--- a/fs/afs/proc.c
+++ b/fs/afs/proc.c
@@ -166,7 +166,7 @@ static int afs_proc_addr_prefs_show(struct seq_file *m, void *v)
 
 	if (!preflist) {
 		seq_puts(m, "NO PREFS\n");
-		return 0;
+		goto out;
 	}
 
 	seq_printf(m, "PROT SUBNET                                      PRIOR (v=%u n=%u/%u/%u)\n",
@@ -191,7 +191,8 @@ static int afs_proc_addr_prefs_show(struct seq_file *m, void *v)
 		}
 	}
 
-	rcu_read_lock();
+out:
+	rcu_read_unlock();
 	return 0;
 }
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] afs: Fix missing/incorrect unlocking of RCU read lock
  2024-01-17 16:14 [PATCH] afs: Fix missing/incorrect unlocking of RCU read lock David Howells
@ 2024-01-17 16:21 ` David Howells
  2024-01-17 16:51   ` Marc Dionne
  2024-01-17 17:15 ` Alan Huang
  1 sibling, 1 reply; 4+ messages in thread
From: David Howells @ 2024-01-17 16:21 UTC (permalink / raw)
  Cc: dhowells, Marc Dionne, linux-afs, linux-fsdevel, linux-kernel

David Howells <dhowells@redhat.com> wrote:

> In afs_proc_addr_prefs_show(), we need to unlock the RCU read lock in both
> places before returning (and not lock it again).
> 
> Fixes: f94f70d39cc2 ("afs: Provide a way to configure address priorities")
> Reported-by: Marc Dionne <marc.dionne@auristor.com>

Actually:

Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202401172243.cd53d5f6-oliver.sang@intel.com
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: linux-afs@lists.infradead.org
> cc: linux-fsdevel@vger.kernel.org

David


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] afs: Fix missing/incorrect unlocking of RCU read lock
  2024-01-17 16:21 ` David Howells
@ 2024-01-17 16:51   ` Marc Dionne
  0 siblings, 0 replies; 4+ messages in thread
From: Marc Dionne @ 2024-01-17 16:51 UTC (permalink / raw)
  To: David Howells; +Cc: linux-afs, linux-fsdevel, linux-kernel

On Wed, Jan 17, 2024 at 12:21 PM David Howells <dhowells@redhat.com> wrote:
>
> David Howells <dhowells@redhat.com> wrote:
>
> > In afs_proc_addr_prefs_show(), we need to unlock the RCU read lock in both
> > places before returning (and not lock it again).
> >
> > Fixes: f94f70d39cc2 ("afs: Provide a way to configure address priorities")
> > Reported-by: Marc Dionne <marc.dionne@auristor.com>
>
> Actually:
>
> Reported-by: kernel test robot <oliver.sang@intel.com>
> Closes: https://lore.kernel.org/oe-lkp/202401172243.cd53d5f6-oliver.sang@intel.com
> > Signed-off-by: David Howells <dhowells@redhat.com>
> > cc: linux-afs@lists.infradead.org
> > cc: linux-fsdevel@vger.kernel.org
>
> David

The fix looks fine.

Reviewed-by: Marc Dionne <marc.dionne@auristor.com>

Marc

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] afs: Fix missing/incorrect unlocking of RCU read lock
  2024-01-17 16:14 [PATCH] afs: Fix missing/incorrect unlocking of RCU read lock David Howells
  2024-01-17 16:21 ` David Howells
@ 2024-01-17 17:15 ` Alan Huang
  1 sibling, 0 replies; 4+ messages in thread
From: Alan Huang @ 2024-01-17 17:15 UTC (permalink / raw)
  To: David Howells; +Cc: Marc Dionne, linux-afs, linux-fsdevel, linux-kernel


> 2024年1月18日 00:14,David Howells <dhowells@redhat.com> 写道:
> 
> In afs_proc_addr_prefs_show(), we need to unlock the RCU read lock in both
> places before returning (and not lock it again).
> 
> Fixes: f94f70d39cc2 ("afs: Provide a way to configure address priorities")
> Reported-by: Marc Dionne <marc.dionne@auristor.com>
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: linux-afs@lists.infradead.org
> cc: linux-fsdevel@vger.kernel.org
> ---
> fs/afs/proc.c |    5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/afs/proc.c b/fs/afs/proc.c
> index 3bd02571f30d..15eab053af6d 100644
> --- a/fs/afs/proc.c
> +++ b/fs/afs/proc.c
> @@ -166,7 +166,7 @@ static int afs_proc_addr_prefs_show(struct seq_file *m, void *v)
> 
> if (!preflist) {
> seq_puts(m, "NO PREFS\n");
> - return 0;
> + goto out;
> }
> 
> seq_printf(m, "PROT SUBNET                                      PRIOR (v=%u n=%u/%u/%u)\n",
> @@ -191,7 +191,8 @@ static int afs_proc_addr_prefs_show(struct seq_file *m, void *v)
> }
> }
> 
> - rcu_read_lock();
> +out:
> + rcu_read_unlock();

What about using:

	guard(rcu)();

Thanks,
Alan

> return 0;
> }
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-17 17:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-17 16:14 [PATCH] afs: Fix missing/incorrect unlocking of RCU read lock David Howells
2024-01-17 16:21 ` David Howells
2024-01-17 16:51   ` Marc Dionne
2024-01-17 17:15 ` Alan Huang

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).