@@ -3740,7 +3740,7 @@ static void nfs4_write_cached_acl(struct inode *inode, struct page **pages,
struct nfs4_cached_acl *acl;
size_t buflen = sizeof(*acl) + acl_len;
- if (buflen <= PAGE_SIZE && srclen <= pgbase + acl_len) {
+ if (buflen <= PAGE_SIZE && srclen >= pgbase + acl_len) {
acl = kmalloc(buflen, GFP_KERNEL);
if (acl == NULL)
goto out;
@@ -3825,7 +3825,7 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu
res.acl_data_offset, res.acl_len);
if (buf) {
ret = -ERANGE;
- if (acl_len > buflen)
+ if (acl_len > buflen || args.acl_len < res.acl_data_offset + res.acl_len)
goto out_free;
_copy_from_pages(buf, pages, res.acl_data_offset,
acl_len);