* [PATCH 1/1] NFSv4.2 re-initialize cn_resp in case of a retry
@ 2020-01-21 22:14 Olga Kornievskaia
2020-01-22 18:40 ` Schumaker, Anna
0 siblings, 1 reply; 3+ messages in thread
From: Olga Kornievskaia @ 2020-01-21 22:14 UTC (permalink / raw)
To: trond.myklebust, anna.schumaker; +Cc: linux-nfs
From: Olga Kornievskaia <kolga@netapp.com>
If nfs42_proc_copy returned a EAGAIN, we need to re-initialize the
memory in case memory allocation fails.
Fixes: 66588abe2 ("NFSv4.2 fix kfree in __nfs42_copy_file_range")
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
---
fs/nfs/nfs4file.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index 620de90..9f72efe 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -177,8 +177,10 @@ static ssize_t __nfs4_copy_file_range(struct file *file_in, loff_t pos_in,
ret = nfs42_proc_copy(file_in, pos_in, file_out, pos_out, count,
nss, cnrs, sync);
out:
- if (!nfs42_files_from_same_server(file_in, file_out))
+ if (!nfs42_files_from_same_server(file_in, file_out)) {
kfree(cn_resp);
+ cn_resp = NULL;
+ }
if (ret == -EAGAIN)
goto retry;
return ret;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] NFSv4.2 re-initialize cn_resp in case of a retry
2020-01-21 22:14 [PATCH 1/1] NFSv4.2 re-initialize cn_resp in case of a retry Olga Kornievskaia
@ 2020-01-22 18:40 ` Schumaker, Anna
2020-01-22 20:27 ` Olga Kornievskaia
0 siblings, 1 reply; 3+ messages in thread
From: Schumaker, Anna @ 2020-01-22 18:40 UTC (permalink / raw)
To: olga.kornievskaia, trond.myklebust; +Cc: linux-nfs
Hi Olga,
On Tue, 2020-01-21 at 17:14 -0500, Olga Kornievskaia wrote:
> From: Olga Kornievskaia <kolga@netapp.com>
>
> If nfs42_proc_copy returned a EAGAIN, we need to re-initialize the
> memory in case memory allocation fails.
I guess I'm not sure how we would hit this. Doesn't kzalloc() return NULL if the
memory allocation fails?
>
> Fixes: 66588abe2 ("NFSv4.2 fix kfree in __nfs42_copy_file_range")
> Reported-by: kbuild test robot <lkp@intel.com>
> Reported-by: Julia Lawall <julia.lawall@lip6.fr>
> Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> ---
> fs/nfs/nfs4file.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
> index 620de90..9f72efe 100644
> --- a/fs/nfs/nfs4file.c
> +++ b/fs/nfs/nfs4file.c
> @@ -177,8 +177,10 @@ static ssize_t __nfs4_copy_file_range(struct file
> *file_in, loff_t pos_in,
> ret = nfs42_proc_copy(file_in, pos_in, file_out, pos_out, count,
> nss, cnrs, sync);
> out:
> - if (!nfs42_files_from_same_server(file_in, file_out))
> + if (!nfs42_files_from_same_server(file_in, file_out)) {
> kfree(cn_resp);
> + cn_resp = NULL;
> + }
> if (ret == -EAGAIN)
> goto retry;
> return ret;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] NFSv4.2 re-initialize cn_resp in case of a retry
2020-01-22 18:40 ` Schumaker, Anna
@ 2020-01-22 20:27 ` Olga Kornievskaia
0 siblings, 0 replies; 3+ messages in thread
From: Olga Kornievskaia @ 2020-01-22 20:27 UTC (permalink / raw)
To: Schumaker, Anna; +Cc: trond.myklebust, linux-nfs
On Wed, Jan 22, 2020 at 1:40 PM Schumaker, Anna
<Anna.Schumaker@netapp.com> wrote:
>
> Hi Olga,
>
> On Tue, 2020-01-21 at 17:14 -0500, Olga Kornievskaia wrote:
> > From: Olga Kornievskaia <kolga@netapp.com>
> >
> > If nfs42_proc_copy returned a EAGAIN, we need to re-initialize the
> > memory in case memory allocation fails.
>
> I guess I'm not sure how we would hit this. Doesn't kzalloc() return NULL if the
> memory allocation fails?
You are right kzalloc would always return NULL so forget about this patch.
>
> >
> > Fixes: 66588abe2 ("NFSv4.2 fix kfree in __nfs42_copy_file_range")
> > Reported-by: kbuild test robot <lkp@intel.com>
> > Reported-by: Julia Lawall <julia.lawall@lip6.fr>
> > Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> > ---
> > fs/nfs/nfs4file.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
> > index 620de90..9f72efe 100644
> > --- a/fs/nfs/nfs4file.c
> > +++ b/fs/nfs/nfs4file.c
> > @@ -177,8 +177,10 @@ static ssize_t __nfs4_copy_file_range(struct file
> > *file_in, loff_t pos_in,
> > ret = nfs42_proc_copy(file_in, pos_in, file_out, pos_out, count,
> > nss, cnrs, sync);
> > out:
> > - if (!nfs42_files_from_same_server(file_in, file_out))
> > + if (!nfs42_files_from_same_server(file_in, file_out)) {
> > kfree(cn_resp);
> > + cn_resp = NULL;
> > + }
> > if (ret == -EAGAIN)
> > goto retry;
> > return ret;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-22 20:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-21 22:14 [PATCH 1/1] NFSv4.2 re-initialize cn_resp in case of a retry Olga Kornievskaia
2020-01-22 18:40 ` Schumaker, Anna
2020-01-22 20:27 ` Olga Kornievskaia
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).