nfsd: propagate SETXATTR value decode errors
Subsystems (3)
PATCH 1/1 nfsd: propagate SETXATTR value decode errors
nfsd4_decode_setxattr() stores the status returned while assembling a non-empty attribute value, but then unconditionally returns nfs_ok. An allocation failure can therefore leave a NULL value buffer paired with a non-zero length and allow compound processing to continue.
Return the decoder status so that the operation stops on the original error.
--- fs/nfsd/nfs4xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4xdr.c +1 -1
@@ -2435,7 +2435,7 @@ nfsd4_decode_setxattr(struct nfsd4_compoundargs *argp, &setxattr->setxa_buf, size); } -return nfs_ok; +return status; } static __be32
Signature · 1 line
2.43.0
Quoted 20 lines · Aldo Ariel Panzardo
nfsd4_decode_setxattr()stores the status returned while assembling a non-empty attribute value, but then unconditionally returnsnfs_ok. An allocation failure can therefore leave a NULL value buffer paired with a non-zero length and allow compound processing to continue.Return the decoder status so that the operation stops on the original error.
Fixes 403366a7e8e2 ("NFSD: Replace READ* macros in nfsd4_decode_setxattr()")Signed-off-by Aldo Ariel Panzardo <[email protected]>--- fs/nfsd/nfs4xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/nfsd/nfs4xdr.c +0
-0
fs/nfsd/nfs4xdr.c nfsd4_decode_setxattr(struct nfsd4_compoundargs *argp, · line 2441
Quoted 8 lines
fs/nfsd/nfs4xdr.c +1
-1@@ -2435,7 +2435,7 @@ nfsd4_decode_setxattr(struct nfsd4_compoundargs *argp, &setxattr->setxa_buf, size); } -return nfs_ok; +return status; } static __be32
Nice catch.
Chuck Lever
maintainerQuoted 9 lines · Aldo Ariel Panzardo
nfsd4_decode_setxattr()stores the status returned while assembling a non-empty attribute value, but then unconditionally returnsnfs_ok. An allocation failure can therefore leave a NULL value buffer paired with a non-zero length and allow compound processing to continue.Return the decoder status so that the operation stops on the original error.
[...]
Applied to nfsd-testing, thanks!
[1/1] nfsd: propagate SETXATTR value decode errors
commit: f6c38392f815da751d4330adad2b937586a0f0fa
--
Chuck Lever