diff --git a/patches.suse/NFSD-fix-LISTXATTRS-returning-a-short-list-with-eof-.patch b/patches.suse/NFSD-fix-LISTXATTRS-returning-a-short-list-with-eof-.patch new file mode 100644 index 0000000..81f807a --- /dev/null +++ b/patches.suse/NFSD-fix-LISTXATTRS-returning-a-short-list-with-eof-.patch @@ -0,0 +1,39 @@ +From: Jorge Mora +Date: Thu, 25 Jan 2024 07:45:28 -0700 +Subject: [PATCH] NFSD: fix LISTXATTRS returning a short list with eof=TRUE +Git-commit: 2f73f37d66774587a0d5053e365736e10fc98c41 +Patch-mainline: v6.9-rc1 +References: git-fixes + +If the XDR buffer is not large enough to fit all attributes +and the remaining bytes left in the XDR buffer (xdrleft) is +equal to the number of bytes for the current attribute, then +the loop will prematurely exit without setting eof to FALSE. +Also in this case, adding the eof flag to the buffer will +make the reply 4 bytes larger than lsxa_maxcount. + +Need to check if there are enough bytes to fit not only the +next attribute name but also the eof as well. + +Fixes: 23e50fe3a5e6 ("nfsd: implement the xattr functions and en/decode logic") +Signed-off-by: Jorge Mora +Reviewed-by: Jeff Layton +Signed-off-by: Chuck Lever +Acked-by: NeilBrown + +--- + fs/nfsd/nfs4xdr.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/fs/nfsd/nfs4xdr.c ++++ b/fs/nfsd/nfs4xdr.c +@@ -5092,7 +5092,8 @@ nfsd4_encode_listxattrs(struct nfsd4_com + + slen -= XATTR_USER_PREFIX_LEN; + xdrlen = 4 + ((slen + 3) & ~3); +- if (xdrlen > xdrleft) { ++ /* Check if both entry and eof can fit in the XDR buffer */ ++ if (xdrlen + XDR_UNIT > xdrleft) { + if (count == 0) { + /* + * Can't even fit the first attribute name. diff --git a/series.conf b/series.conf index 501d063..a135443 100644 --- a/series.conf +++ b/series.conf @@ -45590,6 +45590,7 @@ patches.suse/SUNRPC-fix-some-memleaks-in-gssx_dec_option_array.patch patches.suse/NFSD-fix-nfsd4_listxattr_validate_cookie.patch patches.suse/NFSD-change-LISTXATTRS-cookie-encoding-to-big-endian.patch + patches.suse/NFSD-fix-LISTXATTRS-returning-a-short-list-with-eof-.patch patches.suse/doc-guide-kernel-doc-tell-about-object-like-macros.patch patches.suse/wifi-b43-Stop-wake-correct-queue-in-DMA-Tx-path-when.patch patches.suse/wifi-b43-Stop-wake-correct-queue-in-PIO-Tx-path-when.patch