summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorJorge Mora <jmora1300@gmail.com>2024-01-25 17:51:28 +0300
committerTrond Myklebust <trond.myklebust@hammerspace.com>2024-02-29 00:18:18 +0300
commitbcac8bff90a6ee1629f90669cdb9d28fb86049b0 (patch)
tree96992578512e8194759fbe1ca3f33bd177923a14 /Documentation
parent251a658bbfceafb4d58c76b77682c8bf7bcfad65 (diff)
downloadlinux-bcac8bff90a6ee1629f90669cdb9d28fb86049b0.tar.xz
NFSv4.2: fix listxattr maximum XDR buffer size
Switch order of operations to avoid creating a short XDR buffer: e.g., buflen = 12, old xdrlen = 12, new xdrlen = 20. Having a short XDR buffer leads to lxa_maxcount be a few bytes less than what is needed to retrieve the whole list when using a buflen as returned by a call with size = 0: buflen = listxattr(path, NULL, 0); buf = malloc(buflen); buflen = listxattr(path, buf, buflen); For a file with one attribute (name = '123456'), the first call with size = 0 will return buflen = 12 ('user.123456\x00'). The second call with size = 12, sends LISTXATTRS with lxa_maxcount = 12 + 8 (cookie) + 4 (array count) = 24. The XDR buffer needs 8 (cookie) + 4 (array count) + 4 (name count) + 6 (name len) + 2 (padding) + 4 (eof) = 28 which is 4 bytes shorter than the lxa_maxcount provided in the call. Fixes: 04a5da690e8f ("NFSv4.2: define limits and sizes for user xattr handling") Signed-off-by: Jorge Mora <mora@netapp.com> Reviewed-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'Documentation')
0 files changed, 0 insertions, 0 deletions