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] NFSv4: fix getacl ERANGE for some ACL buffer sizes
Date: Fri, 15 Nov 2013 10:02:08 -0500 [thread overview]
Message-ID: <1384527728-1487-1-git-send-email-dros@netapp.com> (raw)
Besides storing the ACL buffer, the getacl decoder uses the inline
pages for the attr bitmap and buffer length. __nfs4_get_acl_uncached
must allocate enough page space for all of the data to be decoded.
This bug results in getxattr() returning ERANGE when the attr buffer
length is close enough to the nearest PAGE_SIZE multiple that adding
the extra bytes leaves too little room for the ACL buffer.
Signed-off-by: Weston Andros Adamson <dros@netapp.com>
---
fs/nfs/nfs4proc.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 5ab33c0..006cba1 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4453,7 +4453,12 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu
.rpc_argp = &args,
.rpc_resp = &res,
};
- unsigned int npages = DIV_ROUND_UP(buflen, PAGE_SIZE);
+ /*
+ * extra space needed for attr bitmap and length in getacl decoder.
+ * 1 word for bitmap len, 3 words for bitmaps and 1 word for attr len.
+ */
+ unsigned int preamble_len = 20;
+ unsigned int npages = DIV_ROUND_UP(preamble_len + buflen, PAGE_SIZE);
int ret = -ENOMEM, i;
/* As long as we're doing a round trip to the server anyway,
--
1.8.3.1 (Apple Git-46)
next reply other threads:[~2013-11-15 15:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-15 15:02 Weston Andros Adamson [this message]
2013-11-16 19:15 ` [PATCH] NFSv4: fix getacl ERANGE for some ACL buffer sizes Weston Andros Adamson
2013-11-16 20:12 ` Myklebust, Trond
2013-11-21 14:33 ` Weston Andros Adamson
2013-11-21 14:56 ` Myklebust, Trond
2013-11-21 15:38 ` Weston Andros Adamson
-- strict thread matches above, loose matches on Subject: below --
2013-11-21 21:20 [PATCH v2] " Weston Andros Adamson
2015-12-14 22:18 ` J. Bruce Fields
2015-12-14 22:21 ` [PATCH] " J. Bruce Fields
2015-12-14 23:27 ` Trond Myklebust
2015-12-15 14:04 ` J. Bruce Fields
2015-12-23 16:58 ` J. Bruce Fields
2015-12-24 1:37 ` Jeff Layton
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=1384527728-1487-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).