Commit e927119b authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] kNFSd: Fix bug in svc_pushback_unused_pages that occurs on zero byte NFS read

svc_pushback_unused_pages must be ready of the possibility that
no pages were allocated or will need to be pushed back.
parent 925971b6
...@@ -196,14 +196,14 @@ static inline void svc_pushback_allpages(struct svc_rqst *rqstp) ...@@ -196,14 +196,14 @@ static inline void svc_pushback_allpages(struct svc_rqst *rqstp)
static inline void svc_pushback_unused_pages(struct svc_rqst *rqstp) static inline void svc_pushback_unused_pages(struct svc_rqst *rqstp)
{ {
while (rqstp->rq_resused) { while (rqstp->rq_resused &&
rqstp->rq_res.pages != &rqstp->rq_respages[rqstp->rq_resused]) {
if (rqstp->rq_respages[--rqstp->rq_resused] != NULL) { if (rqstp->rq_respages[--rqstp->rq_resused] != NULL) {
rqstp->rq_argpages[rqstp->rq_arghi++] = rqstp->rq_argpages[rqstp->rq_arghi++] =
rqstp->rq_respages[rqstp->rq_resused]; rqstp->rq_respages[rqstp->rq_resused];
rqstp->rq_respages[rqstp->rq_resused] = NULL; rqstp->rq_respages[rqstp->rq_resused] = NULL;
} }
if (rqstp->rq_res.pages == &rqstp->rq_respages[rqstp->rq_resused])
break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment