[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <D21C0923-8182-43A4-A3D0-0DB9DC07F638@gmail.com>
Date: Thu, 18 Jan 2024 01:15:02 +0800
From: Alan Huang <mmpgouride@...il.com>
To: David Howells <dhowells@...hat.com>
Cc: Marc Dionne <marc.dionne@...istor.com>,
linux-afs@...ts.infradead.org,
linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] afs: Fix missing/incorrect unlocking of RCU read lock
> 2024年1月18日 00:14,David Howells <dhowells@...hat.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@...istor.com>
> Signed-off-by: David Howells <dhowells@...hat.com>
> cc: linux-afs@...ts.infradead.org
> cc: linux-fsdevel@...r.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;
> }
>
>
Powered by blists - more mailing lists