Merge branch 'for-3.7' of git://linux-nfs.org/~bfields/linux

Pull nfsd bugfixes from J Bruce Fields.

* 'for-3.7' of git://linux-nfs.org/~bfields/linux:
  SUNRPC: Prevent kernel stack corruption on long values of flush
  NLM: nlm_lookup_file() may return NLMv4-specific error codes
This commit is contained in:
Linus Torvalds 2012-10-19 11:00:00 -07:00
commit 90cdb1a0e6
3 changed files with 5 additions and 4 deletions

View file

@ -223,7 +223,7 @@ static void encode_nlm_stat(struct xdr_stream *xdr,
{ {
__be32 *p; __be32 *p;
BUG_ON(be32_to_cpu(stat) > NLM_LCK_DENIED_GRACE_PERIOD); WARN_ON_ONCE(be32_to_cpu(stat) > NLM_LCK_DENIED_GRACE_PERIOD);
p = xdr_reserve_space(xdr, 4); p = xdr_reserve_space(xdr, 4);
*p = stat; *p = stat;
} }

View file

@ -68,7 +68,8 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
/* Obtain file pointer. Not used by FREE_ALL call. */ /* Obtain file pointer. Not used by FREE_ALL call. */
if (filp != NULL) { if (filp != NULL) {
if ((error = nlm_lookup_file(rqstp, &file, &lock->fh)) != 0) error = cast_status(nlm_lookup_file(rqstp, &file, &lock->fh));
if (error != 0)
goto no_locks; goto no_locks;
*filp = file; *filp = file;

View file

@ -1409,11 +1409,11 @@ static ssize_t read_flush(struct file *file, char __user *buf,
size_t count, loff_t *ppos, size_t count, loff_t *ppos,
struct cache_detail *cd) struct cache_detail *cd)
{ {
char tbuf[20]; char tbuf[22];
unsigned long p = *ppos; unsigned long p = *ppos;
size_t len; size_t len;
sprintf(tbuf, "%lu\n", convert_to_wallclock(cd->flush_time)); snprintf(tbuf, sizeof(tbuf), "%lu\n", convert_to_wallclock(cd->flush_time));
len = strlen(tbuf); len = strlen(tbuf);
if (p >= len) if (p >= len)
return 0; return 0;