Commit 27a5cb49 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Remove MAX_BLKDEV from nfsd

Patch from Andries.Brouwer@cwi.nl

Remove MAX_BLKDEV from nfsd.
parent 3a8280de
......@@ -317,11 +317,10 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp, struct nfsd3_mknodargs *argp,
if (argp->ftype == 0 || argp->ftype >= NF3BAD)
RETURN_STATUS(nfserr_inval);
if (argp->ftype == NF3CHR || argp->ftype == NF3BLK) {
if ((argp->ftype == NF3CHR && argp->major >= MAX_CHRDEV)
|| (argp->ftype == NF3BLK && argp->major >= MAX_BLKDEV)
|| argp->minor > 0xFF)
RETURN_STATUS(nfserr_inval);
rdev = MKDEV(argp->major, argp->minor);
if (MAJOR(rdev) != argp->major ||
MINOR(rdev) != argp->minor)
RETURN_STATUS(nfserr_inval);
} else
if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO)
RETURN_STATUS(nfserr_inval);
......
......@@ -264,6 +264,7 @@ nfsd4_create(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_cre
{
struct svc_fh resfh;
int status;
dev_t rdev;
fh_init(&resfh, NFS4_FHSIZE);
......@@ -288,21 +289,23 @@ nfsd4_create(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_cre
break;
case NF4BLK:
if (create->cr_specdata1 >= MAX_BLKDEV || create->cr_specdata2 > 0xFF)
rdev = MKDEV(create->cr_specdata1, create->cr_specdata2);
if (MAJOR(rdev) != create->cr_specdata1 ||
MINOR(rdev) != create->cr_specdata2)
return nfserr_inval;
status = nfsd_create(rqstp, current_fh, create->cr_name,
create->cr_namelen, &create->cr_iattr, S_IFBLK,
MKDEV(create->cr_specdata1, create->cr_specdata2),
&resfh);
create->cr_namelen, &create->cr_iattr,
S_IFBLK, rdev, &resfh);
break;
case NF4CHR:
if (create->cr_specdata1 >= MAX_CHRDEV || create->cr_specdata2 > 0xFF)
rdev = MKDEV(create->cr_specdata1, create->cr_specdata2);
if (MAJOR(rdev) != create->cr_specdata1 ||
MINOR(rdev) != create->cr_specdata2)
return nfserr_inval;
status = nfsd_create(rqstp, current_fh, create->cr_name,
create->cr_namelen, &create->cr_iattr, S_IFCHR,
MKDEV(create->cr_specdata1, create->cr_specdata2),
&resfh);
create->cr_namelen, &create->cr_iattr,
S_IFCHR, rdev, &resfh);
break;
case NF4SOCK:
......
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