* [PATCH 1/1] NFSv4.2 fix problems with __nfs42_ssc_open
@ 2022-08-18 19:07 Olga Kornievskaia
2022-08-18 19:10 ` Al Viro
0 siblings, 1 reply; 2+ messages in thread
From: Olga Kornievskaia @ 2022-08-18 19:07 UTC (permalink / raw)
To: trond.myklebust, anna.schumaker, viro; +Cc: linux-nfs
From: Olga Kornievskaia <kolga@netapp.com>
A destination server while doing a COPY shouldn't accept using the
passed in filehandle if its not a regular filehandle.
If alloc_file_pseudo() has failed, we need to decrement a reference
on the newly created inode, otherwise it leaks.
Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Fixes: ec4b092508982 ("NFS: inter ssc open")
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
---
fs/nfs/nfs4file.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index e88f6b18445e..9eb181287879 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -340,6 +340,11 @@ static struct file *__nfs42_ssc_open(struct vfsmount *ss_mnt,
goto out;
}
+ if (!S_ISREG(fattr->mode)) {
+ res = ERR_PTR(-EBADF);
+ goto out;
+ }
+
res = ERR_PTR(-ENOMEM);
len = strlen(SSC_READ_NAME_BODY) + 16;
read_name = kzalloc(len, GFP_KERNEL);
@@ -357,6 +362,7 @@ static struct file *__nfs42_ssc_open(struct vfsmount *ss_mnt,
r_ino->i_fop);
if (IS_ERR(filep)) {
res = ERR_CAST(filep);
+ iput(r_ino);
goto out_free_name;
}
--
2.18.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] NFSv4.2 fix problems with __nfs42_ssc_open
2022-08-18 19:07 [PATCH 1/1] NFSv4.2 fix problems with __nfs42_ssc_open Olga Kornievskaia
@ 2022-08-18 19:10 ` Al Viro
0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2022-08-18 19:10 UTC (permalink / raw)
To: Olga Kornievskaia; +Cc: trond.myklebust, anna.schumaker, linux-nfs
On Thu, Aug 18, 2022 at 03:07:05PM -0400, Olga Kornievskaia wrote:
> From: Olga Kornievskaia <kolga@netapp.com>
>
> A destination server while doing a COPY shouldn't accept using the
> passed in filehandle if its not a regular filehandle.
>
> If alloc_file_pseudo() has failed, we need to decrement a reference
> on the newly created inode, otherwise it leaks.
>
> Reported-by: Al Viro <viro@zeniv.linux.org.uk>
> Fixes: ec4b092508982 ("NFS: inter ssc open")
> Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Looks sane from the VFS interactions POV...
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-18 19:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-18 19:07 [PATCH 1/1] NFSv4.2 fix problems with __nfs42_ssc_open Olga Kornievskaia
2022-08-18 19:10 ` Al Viro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox