From: Dan Carpenter <dan.carpenter@oracle.com>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org, kernel-janitors@vger.kernel.org,
Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Subject: [PATCH] NFSD: check for negative "len" values in nfssvc_decode_writeargs()
Date: Mon, 14 Mar 2022 17:06:35 +0300 [thread overview]
Message-ID: <20220314140635.GD30883@kili> (raw)
This code checks the upper bound of "len" but it needs to check for
negative values as well.
Fixes: a51b5b737a0b ("NFSD: Update the NFSv2 WRITE argument decoder to use struct xdr_stream")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
From static analysis and I am not sure of the implications of this bug.
fs/nfsd/nfsxdr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index aba8520b4b8b..a9f80e30320e 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -336,7 +336,7 @@ nfssvc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
/* opaque data */
if (xdr_stream_decode_u32(xdr, &args->len) < 0)
return false;
- if (args->len > NFSSVC_MAXBLKSIZE_V2)
+ if (args->len < 0 || args->len > NFSSVC_MAXBLKSIZE_V2)
return false;
if (!xdr_stream_subsegment(xdr, &args->payload, args->len))
return false;
--
2.20.1
next reply other threads:[~2022-03-14 14:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-14 14:06 Dan Carpenter [this message]
2022-03-14 14:42 ` [PATCH] NFSD: check for negative "len" values in nfssvc_decode_writeargs() Chuck Lever III
2022-03-15 9:45 ` Dan Carpenter
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=20220314140635.GD30883@kili \
--to=dan.carpenter@oracle.com \
--cc=chuck.lever@oracle.com \
--cc=harshit.m.mogalapalli@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
/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 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.