NFSD: Fix bad checking of space for padding in splice read
Subsystems (2)
PATCH 1/1 NFSD: Fix bad checking of space for padding in splice read
Fix commit dc97618ddd (nfsd4: separate splice and readv cases). xdr->end and xdr->p are type of __be32 *, so padding needs one here.
--- fs/nfsd/nfs4xdr.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
fs/nfsd/nfs4xdr.c +2 -5
@@ -3067,11 +3067,8 @@ static __be32 nfsd4_encode_splice_read(__be32 nfserr;__be32 *p = xdr->p -2 ; -/* -* Don't inline pages unless we know there's room for eof, -* count, and possible padding: -*/ -if (xdr->end - xdr->p <3 ) +/* Make sure there will be room for padding if needed */ +if (xdr->end - xdr->p <1 )return nfserr_resource; nfserr = nfsd_splice_read(read->rd_rqstp, file,
Signature · 1 line
1.9.3
Quoted 2 lines · Kinglong Mee
Fix commit
dc97618ddd(nfsd4: separate splice and readv cases).xdr->endandxdr->pare type of__be32*, so padding needs one here.
I agree with the patch, but not the changelog.
The problem here is that xdr->p isn't that those are __be32 *'s, but that xdr->p has already advanced past the eof and the count, right?
Applying with an updated changelog.
--b.
Quoted 27 lines
Signed-off-by Kinglong Mee <[email protected]>--- fs/nfsd/nfs4xdr.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)fs/nfsd/nfs4xdr.c +2
-5@@ -3067,11 +3067,8 @@ static __be32 nfsd4_encode_splice_read(__be32 nfserr;__be32 *p = xdr->p -2 ; -/* -* Don't inline pages unless we know there's room for eof, -* count, and possible padding: -*/ -if (xdr->end - xdr->p <3 ) +/* Make sure there will be room for padding if needed */ +if (xdr->end - xdr->p <1 )return nfserr_resource; nfserr = nfsd_splice_read(read->rd_rqstp, file,Signature · 1 line
1.9.3
Quoted 10 lines · J. Bruce Fields
Quoted 2 lines · Kinglong Mee
Fix commit
dc97618ddd(nfsd4: separate splice and readv cases).xdr->endandxdr->pare type of__be32*, so padding needs one here.I agree with the patch, but not the changelog.
The problem here is that
xdr->pisn't that those are__be32*'s, but thatxdr->phas already advanced past the eof and the count, right?Applying with an updated changelog.
(And applying for 3.17 (not 3.16) as this looks hard to hit.)
--b.
Quoted 30 lines
--b.
Quoted 27 lines
Signed-off-by Kinglong Mee <[email protected]>--- fs/nfsd/nfs4xdr.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)fs/nfsd/nfs4xdr.c +2
-5@@ -3067,11 +3067,8 @@ static __be32 nfsd4_encode_splice_read(__be32 nfserr;__be32 *p = xdr->p -2 ; -/* -* Don't inline pages unless we know there's room for eof, -* count, and possible padding: -*/ -if (xdr->end - xdr->p <3 ) +/* Make sure there will be room for padding if needed */ +if (xdr->end - xdr->p <1 )return nfserr_resource; nfserr = nfsd_splice_read(read->rd_rqstp, file,Signature · 1 line
1.9.3