From: Weston Andros Adamson <dros@netapp.com>
To: <Trond.Myklebust@netapp.com>
Cc: <linux-nfs@vger.kernel.org>, Weston Andros Adamson <dros@netapp.com>
Subject: [PATCH] NFS: -EIO from decode_bitmap if too many bitmaps
Date: Fri, 15 Nov 2013 11:38:01 -0500 [thread overview]
Message-ID: <1384533481-2254-1-git-send-email-dros@netapp.com> (raw)
decode_bitmap will only decode up to three bitmaps. If the xdr buffer
has more than three bitmaps, return -EIO here instead of bailing out in
a later xdr decode.
Signed-off-by: Weston Andros Adamson <dros@netapp.com>
---
This is related to my "NFSv4: fix getacl ERANGE for some ACL buffer sizes"
patch - I noticed that even though we'll only ever parse 3 bitmaps, we don't
error out correctly if more are sent.
This condition is probably never hit, but if it ever is, it'd be nice to
have the code error out where the problem actually occurred.
fs/nfs/nfs4xdr.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 5be2868..3866a69 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -3146,6 +3146,9 @@ static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
goto out_overflow;
bmlen = be32_to_cpup(p);
+ if (unlikely(bmlen > 3))
+ goto out_overflow;
+
bitmap[0] = bitmap[1] = bitmap[2] = 0;
p = xdr_inline_decode(xdr, (bmlen << 2));
if (unlikely(!p))
--
1.8.3.1 (Apple Git-46)
next reply other threads:[~2013-11-15 16:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-15 16:38 Weston Andros Adamson [this message]
2013-11-15 16:57 ` [PATCH] NFS: -EIO from decode_bitmap if too many bitmaps Chuck Lever
2013-11-15 17:00 ` Trond Myklebust
2013-11-15 17:05 ` Myklebust, Trond
2013-11-15 17:07 ` Chuck Lever
2013-11-15 17:10 ` Myklebust, Trond
2013-11-15 17:22 ` Weston Andros Adamson
2013-11-15 17:23 ` Chuck Lever
2013-11-15 17:28 ` Myklebust, Trond
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=1384533481-2254-1-git-send-email-dros@netapp.com \
--to=dros@netapp.com \
--cc=Trond.Myklebust@netapp.com \
--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 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).