Skip to content

Commit

Permalink
[PATCH] knfsd: svcrpc: WARN() instead of returning an error from svc_…
Browse files Browse the repository at this point in the history
…take_page

Every caller of svc_take_page ignores its return value and assumes it
succeeded.  So just WARN() instead of returning an ignored error.  This would
have saved some time debugging a recent nfsd4 problem.

If there are still failure cases here, then the result is probably that we
overwrite an earlier part of the reply while xdr-encoding.

While the corrupted reply is a nasty bug, it would be worse to panic here and
create the possibility of a remote DOS; hence WARN() instead of BUG().

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
Cc: Ingo Oeser <ioe-lkml@rameria.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
J. Bruce Fields authored and Linus Torvalds committed Apr 11, 2006
1 parent dfee55f commit 6f54e2d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions include/linux/sunrpc/svc.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,16 @@ svc_take_res_page(struct svc_rqst *rqstp)
return rqstp->rq_respages[rqstp->rq_resused++];
}

static inline int svc_take_page(struct svc_rqst *rqstp)
static inline void svc_take_page(struct svc_rqst *rqstp)
{
if (rqstp->rq_arghi <= rqstp->rq_argused)
return -ENOMEM;
if (rqstp->rq_arghi <= rqstp->rq_argused) {
WARN_ON(1);
return;
}
rqstp->rq_arghi--;
rqstp->rq_respages[rqstp->rq_resused] =
rqstp->rq_argpages[rqstp->rq_arghi];
rqstp->rq_resused++;
return 0;
}

static inline void svc_pushback_allpages(struct svc_rqst *rqstp)
Expand Down

0 comments on commit 6f54e2d

Please sign in to comment.