From: David Laight <David.Laight@ACULAB.COM>
To: 'Scott Mayhew' <smayhew@redhat.com>
Cc: Li Lingfeng <lilingfeng3@huawei.com>,
"chuck.lever@oracle.com" <chuck.lever@oracle.com>,
"jlayton@kernel.org" <jlayton@kernel.org>,
"neilb@suse.de" <neilb@suse.de>,
"okorniev@redhat.com" <okorniev@redhat.com>,
"Dai.Ngo@oracle.com" <Dai.Ngo@oracle.com>,
"tom@talpey.com" <tom@talpey.com>,
"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"yukuai1@huaweicloud.com" <yukuai1@huaweicloud.com>,
"houtao1@huawei.com" <houtao1@huawei.com>,
"yi.zhang@huawei.com" <yi.zhang@huawei.com>,
"yangerkun@huawei.com" <yangerkun@huawei.com>,
"lilingfeng@huaweicloud.com" <lilingfeng@huaweicloud.com>
Subject: RE: [PATCH] nfsd: return -EINVAL when namelen is 0
Date: Mon, 9 Sep 2024 11:33:04 +0000 [thread overview]
Message-ID: <674f0d570dc241bf86294a9c8141a0b4@AcuMS.aculab.com> (raw)
In-Reply-To: <Zt7a2XO-ze1aAM-d@aion>
From: Scott Mayhew
> Sent: 09 September 2024 12:24
...
> > > > diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
> > > > index 67d8673a9391..69a3a84e159e 100644
> > > > --- a/fs/nfsd/nfs4recover.c
> > > > +++ b/fs/nfsd/nfs4recover.c
> > > > @@ -809,6 +809,10 @@ __cld_pipe_inprogress_downcall(const struct cld_msg_v2 __user *cmsg,
> > > > ci = &cmsg->cm_u.cm_clntinfo;
> > > > if (get_user(namelen, &ci->cc_name.cn_len))
> > > > return -EFAULT;
> > > > + if (!namelen) {
> > > > + dprintk("%s: namelen should not be zero", __func__);
> > > > + return -EINVAL;
> > > > + }
> > > > name.data = memdup_user(&ci->cc_name.cn_id, namelen);
> >
> > Don't you also want an upper bound sanity check?
> > (or is cn_len only 8 bit?)
>
> Yeah, actually it should probably be checking for namelen >
> NFS4_OPAQUE_LIMIT.
I suspect memdup_user() itself should have a third 'maxlen' argument.
And probably one that is required to be a compile-time constant.
Oh, and is dprintk() rate-limited?
Not that the message looks very helpful.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2024-09-09 11:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-03 11:14 [PATCH] nfsd: return -EINVAL when namelen is 0 Li Lingfeng
2024-09-03 11:23 ` Jeff Layton
2024-09-03 15:27 ` Chuck Lever
2024-09-03 15:35 ` Jeff Layton
2024-09-03 21:35 ` Chuck Lever
2024-09-04 13:06 ` Guoqing Jiang
2024-09-04 14:16 ` Chuck Lever
2024-09-04 14:48 ` Scott Mayhew
2024-09-05 1:25 ` Li Lingfeng
2024-09-08 20:25 ` David Laight
2024-09-09 11:24 ` Scott Mayhew
2024-09-09 11:33 ` David Laight [this message]
2024-09-09 14:10 ` Chuck Lever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=674f0d570dc241bf86294a9c8141a0b4@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=Dai.Ngo@oracle.com \
--cc=chuck.lever@oracle.com \
--cc=houtao1@huawei.com \
--cc=jlayton@kernel.org \
--cc=lilingfeng3@huawei.com \
--cc=lilingfeng@huaweicloud.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=okorniev@redhat.com \
--cc=smayhew@redhat.com \
--cc=tom@talpey.com \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai1@huaweicloud.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox