Skip to content

Commit

Permalink
knfsd: fix reply cache memory corruption
Browse files Browse the repository at this point in the history
Fix a regression in the reply cache introduced when the code was
converted to use proper Linux lists.  When a new entry needs to be
inserted, the case where all the entries are currently being used
by threads is not correctly detected.  This can result in memory
corruption and a crash.  In the current code this is an extremely
unlikely corner case; it would require the machine to have 1024
nfsd threads and all of them to be busy at the same time.  However,
upcoming reply cache changes make this more likely; a crash due to
this problem was actually observed in field.

Signed-off-by: Greg Banks <gnb@sgi.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
  • Loading branch information
Greg Banks authored and J. Bruce Fields committed May 27, 2009
1 parent fca4217 commit cf0a586
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/nfsd/nfscache.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ nfsd_cache_lookup(struct svc_rqst *rqstp, int type)
}
}

/* This should not happen */
if (rp == NULL) {
/* All entries on the LRU are in-progress. This should not happen */
if (&rp->c_lru == &lru_head) {
static int complaints;

printk(KERN_WARNING "nfsd: all repcache entries locked!\n");
Expand Down

0 comments on commit cf0a586

Please sign in to comment.