diff options
-rw-r--r-- | fs/nfs/nfs4proc.c | 20 | ||||
-rw-r--r-- | fs/nfs/nfs4xdr.c | 5 | ||||
-rw-r--r-- | include/linux/nfs_xdr.h | 5 |
3 files changed, 19 insertions, 11 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index aea2e83d3939..20c9acf689fd 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2755,12 +2755,14 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu | |||
2755 | .acl_pages = pages, | 2755 | .acl_pages = pages, |
2756 | .acl_len = buflen, | 2756 | .acl_len = buflen, |
2757 | }; | 2757 | }; |
2758 | size_t resp_len = buflen; | 2758 | struct nfs_getaclres res = { |
2759 | .acl_len = buflen, | ||
2760 | }; | ||
2759 | void *resp_buf; | 2761 | void *resp_buf; |
2760 | struct rpc_message msg = { | 2762 | struct rpc_message msg = { |
2761 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETACL], | 2763 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETACL], |
2762 | .rpc_argp = &args, | 2764 | .rpc_argp = &args, |
2763 | .rpc_resp = &resp_len, | 2765 | .rpc_resp = &res, |
2764 | }; | 2766 | }; |
2765 | struct page *localpage = NULL; | 2767 | struct page *localpage = NULL; |
2766 | int ret; | 2768 | int ret; |
@@ -2774,7 +2776,7 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu | |||
2774 | return -ENOMEM; | 2776 | return -ENOMEM; |
2775 | args.acl_pages[0] = localpage; | 2777 | args.acl_pages[0] = localpage; |
2776 | args.acl_pgbase = 0; | 2778 | args.acl_pgbase = 0; |
2777 | resp_len = args.acl_len = PAGE_SIZE; | 2779 | args.acl_len = PAGE_SIZE; |
2778 | } else { | 2780 | } else { |
2779 | resp_buf = buf; | 2781 | resp_buf = buf; |
2780 | buf_to_pages(buf, buflen, args.acl_pages, &args.acl_pgbase); | 2782 | buf_to_pages(buf, buflen, args.acl_pages, &args.acl_pgbase); |
@@ -2782,18 +2784,18 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu | |||
2782 | ret = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); | 2784 | ret = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); |
2783 | if (ret) | 2785 | if (ret) |
2784 | goto out_free; | 2786 | goto out_free; |
2785 | if (resp_len > args.acl_len) | 2787 | if (res.acl_len > args.acl_len) |
2786 | nfs4_write_cached_acl(inode, NULL, resp_len); | 2788 | nfs4_write_cached_acl(inode, NULL, res.acl_len); |
2787 | else | 2789 | else |
2788 | nfs4_write_cached_acl(inode, resp_buf, resp_len); | 2790 | nfs4_write_cached_acl(inode, resp_buf, res.acl_len); |
2789 | if (buf) { | 2791 | if (buf) { |
2790 | ret = -ERANGE; | 2792 | ret = -ERANGE; |
2791 | if (resp_len > buflen) | 2793 | if (res.acl_len > buflen) |
2792 | goto out_free; | 2794 | goto out_free; |
2793 | if (localpage) | 2795 | if (localpage) |
2794 | memcpy(buf, resp_buf, resp_len); | 2796 | memcpy(buf, resp_buf, res.acl_len); |
2795 | } | 2797 | } |
2796 | ret = resp_len; | 2798 | ret = res.acl_len; |
2797 | out_free: | 2799 | out_free: |
2798 | if (localpage) | 2800 | if (localpage) |
2799 | __free_page(localpage); | 2801 | __free_page(localpage); |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index a77ee3dd0b3d..3e777893e2b0 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -4018,7 +4018,8 @@ out: | |||
4018 | * Decode GETACL response | 4018 | * Decode GETACL response |
4019 | */ | 4019 | */ |
4020 | static int | 4020 | static int |
4021 | nfs4_xdr_dec_getacl(struct rpc_rqst *rqstp, __be32 *p, size_t *acl_len) | 4021 | nfs4_xdr_dec_getacl(struct rpc_rqst *rqstp, __be32 *p, |
4022 | struct nfs_getaclres *res) | ||
4022 | { | 4023 | { |
4023 | struct xdr_stream xdr; | 4024 | struct xdr_stream xdr; |
4024 | struct compound_hdr hdr; | 4025 | struct compound_hdr hdr; |
@@ -4031,7 +4032,7 @@ nfs4_xdr_dec_getacl(struct rpc_rqst *rqstp, __be32 *p, size_t *acl_len) | |||
4031 | status = decode_putfh(&xdr); | 4032 | status = decode_putfh(&xdr); |
4032 | if (status) | 4033 | if (status) |
4033 | goto out; | 4034 | goto out; |
4034 | status = decode_getacl(&xdr, rqstp, acl_len); | 4035 | status = decode_getacl(&xdr, rqstp, &res->acl_len); |
4035 | 4036 | ||
4036 | out: | 4037 | out: |
4037 | return status; | 4038 | return status; |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 56523319e14c..6e9ee2848606 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -444,6 +444,11 @@ struct nfs_getaclargs { | |||
444 | struct nfs4_sequence_args seq_args; | 444 | struct nfs4_sequence_args seq_args; |
445 | }; | 445 | }; |
446 | 446 | ||
447 | struct nfs_getaclres { | ||
448 | size_t acl_len; | ||
449 | struct nfs4_sequence_res seq_res; | ||
450 | }; | ||
451 | |||
447 | struct nfs_setattrres { | 452 | struct nfs_setattrres { |
448 | struct nfs_fattr * fattr; | 453 | struct nfs_fattr * fattr; |
449 | const struct nfs_server * server; | 454 | const struct nfs_server * server; |