aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2006-04-11 01:55:36 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-11 09:18:52 -0400
commit6f54e2d0d3a904e55c9c50b78542072f6c42080e (patch)
treecde5f03d8e80477c7bebcde0e41c48df85dd9846
parentdfee55f06213a23b250ea63ba41caa461cdd5e72 (diff)
[PATCH] knfsd: svcrpc: WARN() instead of returning an error from svc_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>
-rw-r--r--include/linux/sunrpc/svc.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 50cab2a09f28..503564384545 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -197,15 +197,16 @@ svc_take_res_page(struct svc_rqst *rqstp)
197 return rqstp->rq_respages[rqstp->rq_resused++]; 197 return rqstp->rq_respages[rqstp->rq_resused++];
198} 198}
199 199
200static inline int svc_take_page(struct svc_rqst *rqstp) 200static inline void svc_take_page(struct svc_rqst *rqstp)
201{ 201{
202 if (rqstp->rq_arghi <= rqstp->rq_argused) 202 if (rqstp->rq_arghi <= rqstp->rq_argused) {
203 return -ENOMEM; 203 WARN_ON(1);
204 return;
205 }
204 rqstp->rq_arghi--; 206 rqstp->rq_arghi--;
205 rqstp->rq_respages[rqstp->rq_resused] = 207 rqstp->rq_respages[rqstp->rq_resused] =
206 rqstp->rq_argpages[rqstp->rq_arghi]; 208 rqstp->rq_argpages[rqstp->rq_arghi];
207 rqstp->rq_resused++; 209 rqstp->rq_resused++;
208 return 0;
209} 210}
210 211
211static inline void svc_pushback_allpages(struct svc_rqst *rqstp) 212static inline void svc_pushback_allpages(struct svc_rqst *rqstp)