* [PATCH] nfs: check nf pointer for validity before use
@ 2021-12-21 18:55 Muhammad Usama Anjum
2021-12-21 20:00 ` Chuck Lever III
2021-12-21 22:18 ` Konstantin Ryabitsev
0 siblings, 2 replies; 4+ messages in thread
From: Muhammad Usama Anjum @ 2021-12-21 18:55 UTC (permalink / raw)
To: J. Bruce Fields, Chuck Lever, Vasily Averin,
open list:KERNEL NFSD, SUNRPC, AND LOCKD SERVERS, open list
Cc: usama.anjum, kernel, kernel-janitors
Pointer nf can be NULL. It should be validated before dereferencing it.
Fixes: 8628027ba8 ("nfs: block notification on fs with its own ->lock")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
fs/nfsd/nfs4state.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index a526d4183348..bdd30988e615 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -6947,6 +6947,11 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
goto out;
}
+ if (!nf) {
+ status = nfserr_openmode;
+ goto out;
+ }
+
/*
* Most filesystems with their own ->lock operations will block
* the nfsd thread waiting to acquire the lock. That leads to
@@ -6957,11 +6962,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
if (nf->nf_file->f_op->lock)
fl_flags &= ~FL_SLEEP;
- if (!nf) {
- status = nfserr_openmode;
- goto out;
- }
-
nbl = find_or_allocate_block(lock_sop, &fp->fi_fhandle, nn);
if (!nbl) {
dprintk("NFSD: %s: unable to allocate block!\n", __func__);
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] nfs: check nf pointer for validity before use
2021-12-21 18:55 [PATCH] nfs: check nf pointer for validity before use Muhammad Usama Anjum
@ 2021-12-21 20:00 ` Chuck Lever III
2021-12-21 22:18 ` Konstantin Ryabitsev
1 sibling, 0 replies; 4+ messages in thread
From: Chuck Lever III @ 2021-12-21 20:00 UTC (permalink / raw)
To: Muhammad Usama Anjum
Cc: Bruce Fields, Vasily Averin, Linux NFS Mailing List, open list,
kernel, kernel-janitors
Hi-
> On Dec 21, 2021, at 1:55 PM, Muhammad Usama Anjum <usama.anjum@collabora.com> wrote:
>
> Pointer nf can be NULL. It should be validated before dereferencing it.
>
> Fixes: 8628027ba8 ("nfs: block notification on fs with its own ->lock")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Thanks. To avoid confusion I've squashed this into 8628027 and
refreshed my for-next branch.
Btw, b4 complained about collabora.com's DKIM:
[cel@bazille linux]$ b4 am https://lore.kernel.org/linux-nfs/YcIjJ4jN3ax1rqaE@debian-BULLSEYE-live-builder-AMD64/raw
Grabbing thread from lore.kernel.org/linux-nfs/YcIjJ4jN3ax1rqaE%40debian-BULLSEYE-live-builder-AMD64/t.mbox.gz
Analyzing 1 messages in the thread
Checking attestation on all messages, may take a moment...
---
✗ [PATCH] nfs: check nf pointer for validity before use
---
✗ BADSIG: DKIM/collabora.com
---
Total patches: 1
---
Link: https://lore.kernel.org/r/YcIjJ4jN3ax1rqaE@debian-BULLSEYE-live-builder-AMD64
Base: not specified
git am ./20211221_usama_anjum_nfs_check_nf_pointer_for_validity_before_use.mbx
[cel@bazille linux]$
The patch is obviously correct, so I applied it despite the
attestation failure.
> ---
> fs/nfsd/nfs4state.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index a526d4183348..bdd30988e615 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -6947,6 +6947,11 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> goto out;
> }
>
> + if (!nf) {
> + status = nfserr_openmode;
> + goto out;
> + }
> +
> /*
> * Most filesystems with their own ->lock operations will block
> * the nfsd thread waiting to acquire the lock. That leads to
> @@ -6957,11 +6962,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> if (nf->nf_file->f_op->lock)
> fl_flags &= ~FL_SLEEP;
>
> - if (!nf) {
> - status = nfserr_openmode;
> - goto out;
> - }
> -
> nbl = find_or_allocate_block(lock_sop, &fp->fi_fhandle, nn);
> if (!nbl) {
> dprintk("NFSD: %s: unable to allocate block!\n", __func__);
> --
> 2.30.2
>
--
Chuck Lever
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nfs: check nf pointer for validity before use
2021-12-21 18:55 [PATCH] nfs: check nf pointer for validity before use Muhammad Usama Anjum
2021-12-21 20:00 ` Chuck Lever III
@ 2021-12-21 22:18 ` Konstantin Ryabitsev
2021-12-22 6:06 ` Tomeu Vizoso
1 sibling, 1 reply; 4+ messages in thread
From: Konstantin Ryabitsev @ 2021-12-21 22:18 UTC (permalink / raw)
To: Chuck Lever III, Muhammad Usama Anjum
Cc: Bruce Fields, Vasily Averin, Linux NFS Mailing List, open list,
kernel, kernel-janitors
December 21, 2021 3:00 PM, "Chuck Lever III" <chuck.lever@oracle.com> wrote:
> Btw, b4 complained about collabora.com's DKIM:
>
> [cel@bazille linux]$ b4 am
> https://lore.kernel.org/linux-nfs/YcIjJ4jN3ax1rqaE@debian-BULLSEYE-live-builder-AMD64/raw
> Grabbing thread from
> lore.kernel.org/linux-nfs/YcIjJ4jN3ax1rqaE%40debian-BULLSEYE-live-builder-AMD64/t.mbox.gz
> Analyzing 1 messages in the thread
> Checking attestation on all messages, may take a moment...
> ---
> ✗ [PATCH] nfs: check nf pointer for validity before use
> ---
> ✗ BADSIG: DKIM/collabora.com
This is because collabora.com has DKIM canonicalization configured as "c=simple/simple". See my previous message to intel.com for why this should be changed to c=relaxed/simple:
https://lore.kernel.org/lkml/20211214150032.nioelgvmase7yyus@meerkat.local/
Hope this helps.
-K
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nfs: check nf pointer for validity before use
2021-12-21 22:18 ` Konstantin Ryabitsev
@ 2021-12-22 6:06 ` Tomeu Vizoso
0 siblings, 0 replies; 4+ messages in thread
From: Tomeu Vizoso @ 2021-12-22 6:06 UTC (permalink / raw)
To: Konstantin Ryabitsev, Chuck Lever III, Muhammad Usama Anjum
Cc: Bruce Fields, Vasily Averin, Linux NFS Mailing List, open list,
kernel, kernel-janitors
On 12/21/21 11:18 PM, Konstantin Ryabitsev wrote:
> December 21, 2021 3:00 PM, "Chuck Lever III" <chuck.lever@oracle.com> wrote:
>> Btw, b4 complained about collabora.com's DKIM:
>>
>> [cel@bazille linux]$ b4 am
>> https://lore.kernel.org/linux-nfs/YcIjJ4jN3ax1rqaE@debian-BULLSEYE-live-builder-AMD64/raw
>> Grabbing thread from
>> lore.kernel.org/linux-nfs/YcIjJ4jN3ax1rqaE%40debian-BULLSEYE-live-builder-AMD64/t.mbox.gz
>> Analyzing 1 messages in the thread
>> Checking attestation on all messages, may take a moment...
>> ---
>> ✗ [PATCH] nfs: check nf pointer for validity before use
>> ---
>> ✗ BADSIG: DKIM/collabora.com
>
> This is because collabora.com has DKIM canonicalization configured as "c=simple/simple". See my previous message to intel.com for why this should be changed to c=relaxed/simple:
>
> https://lore.kernel.org/lkml/20211214150032.nioelgvmase7yyus@meerkat.local/
Thank you both, Chuck and Konstantin,
I have forwarded this conversation to our sysadmin team.
Best regards,
Tomeu
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-12-22 6:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-21 18:55 [PATCH] nfs: check nf pointer for validity before use Muhammad Usama Anjum
2021-12-21 20:00 ` Chuck Lever III
2021-12-21 22:18 ` Konstantin Ryabitsev
2021-12-22 6:06 ` Tomeu Vizoso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.