Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 147410 Details for
Bug 222798
nfs protocol V3 :write procedure patch
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Proposed patch
222798.rhel-4 (text/plain), 4.29 KB, created by
Peter Staubach
on 2007-02-05 21:58:41 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Peter Staubach
Created:
2007-02-05 21:58:41 UTC
Size:
4.29 KB
patch
obsolete
>--- linux-2.6.9/fs/nfsd/nfsxdr.c.org >+++ linux-2.6.9/fs/nfsd/nfsxdr.c >@@ -277,8 +277,9 @@ int > nfssvc_decode_writeargs(struct svc_rqst *rqstp, u32 *p, > struct nfsd_writeargs *args) > { >- unsigned int len; >+ unsigned int len, hdr, dlen; > int v; >+ > if (!(p = decode_fh(p, &args->fh))) > return 0; > >@@ -286,11 +287,42 @@ nfssvc_decode_writeargs(struct svc_rqst > args->offset = ntohl(*p++); /* offset */ > p++; /* totalcount */ > len = args->len = ntohl(*p++); >+ /* >+ * The protocol specifies a maximum of NFS_MAXDATA bytes. >+ */ >+ if (len > NFS_MAXDATA) >+ return 0; >+ >+ /* >+ * Check to make sure that we got the right number of >+ * bytes. >+ * >+ * If more than one page was used, then compute the length >+ * of the data in the request as the total size of the >+ * request minus the transport protocol headers minus the >+ * RPC protocol headers minus the NFS protocol fields >+ * already consumed. If the request fits into a single >+ * page, then compete the length of the data as the size >+ * of the NFS portion of the request minus the NFS >+ * protocol fields already consumed. >+ */ >+ hdr = (void*)p - rqstp->rq_arg.head[0].iov_base; >+ if (rqstp->rq_argused > 1) { >+ dlen = rqstp->rq_arg.len - >+ (PAGE_SIZE - rqstp->rq_arg.head[0].iov_len) - hdr; >+ } else { >+ dlen = rqstp->rq_arg.head[0].iov_len - hdr; >+ } >+ /* >+ * Round the length of the data which was specified up to >+ * the next multiple of XDR units and then compare that >+ * against the length which was actually received. >+ */ >+ if (dlen != ((len + 3) & ~0x3)) >+ return 0; >+ > args->vec[0].iov_base = (void*)p; >- args->vec[0].iov_len = rqstp->rq_arg.head[0].iov_len - >- (((void*)p) - rqstp->rq_arg.head[0].iov_base); >- if (len > NFSSVC_MAXBLKSIZE) >- len = NFSSVC_MAXBLKSIZE; >+ args->vec[0].iov_len = rqstp->rq_arg.head[0].iov_len - hdr; > v = 0; > while (len > args->vec[v].iov_len) { > len -= args->vec[v].iov_len; >@@ -299,8 +331,8 @@ nfssvc_decode_writeargs(struct svc_rqst > args->vec[v].iov_len = PAGE_SIZE; > } > args->vec[v].iov_len = len; >- args->vlen = v+1; >- return args->vec[0].iov_len > 0; >+ args->vlen = v + 1; >+ return 1; > } > > int >--- linux-2.6.9/fs/nfsd/nfs3xdr.c.org >+++ linux-2.6.9/fs/nfsd/nfs3xdr.c >@@ -371,7 +371,7 @@ int > nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p, > struct nfsd3_writeargs *args) > { >- unsigned int len, v, hdr; >+ unsigned int len, v, hdr, dlen; > > if (!(p = decode_fh(p, &args->fh)) > || !(p = xdr_decode_hyper(p, &args->offset))) >@@ -380,17 +380,45 @@ nfs3svc_decode_writeargs(struct svc_rqst > args->count = ntohl(*p++); > args->stable = ntohl(*p++); > len = args->len = ntohl(*p++); >+ /* >+ * The count must equal the amount of data passed. >+ */ >+ if (args->count != args->len) >+ return 0; > >+ /* >+ * Check to make sure that we got the right number of >+ * bytes. >+ * >+ * If more than one page was used, then compute the length >+ * of the data in the request as the total size of the >+ * request minus the transport protocol headers minus the >+ * RPC protocol headers minus the NFS protocol fields >+ * already consumed. If the request fits into a single >+ * page, then compete the length of the data as the size >+ * of the NFS portion of the request minus the NFS >+ * protocol fields already consumed. >+ */ > hdr = (void*)p - rqstp->rq_arg.head[0].iov_base; >- if (rqstp->rq_arg.len < len + hdr) >+ if (rqstp->rq_argused > 1) { >+ dlen = rqstp->rq_arg.len - >+ (PAGE_SIZE - rqstp->rq_arg.head[0].iov_len) - hdr; >+ } else { >+ dlen = rqstp->rq_arg.head[0].iov_len - hdr; >+ } >+ /* >+ * Round the length of the data which was specified up to >+ * the next multiple of XDR units and then compare that >+ * against the length which was actually received. >+ */ >+ if (dlen != ((len + 3) & ~0x3)) > return 0; > >- args->vec[0].iov_base = (void*)p; >- args->vec[0].iov_len = rqstp->rq_arg.head[0].iov_len - hdr; >- > if (len > NFSSVC_MAXBLKSIZE) > len = NFSSVC_MAXBLKSIZE; >- v= 0; >+ args->vec[0].iov_base = (void*)p; >+ args->vec[0].iov_len = rqstp->rq_arg.head[0].iov_len - hdr; >+ v = 0; > while (len > args->vec[v].iov_len) { > len -= args->vec[v].iov_len; > v++; >@@ -398,9 +426,8 @@ nfs3svc_decode_writeargs(struct svc_rqst > args->vec[v].iov_len = PAGE_SIZE; > } > args->vec[v].iov_len = len; >- args->vlen = v+1; >- >- return args->count == args->len && args->vec[0].iov_len > 0; >+ args->vlen = v + 1; >+ return 1; > } > > int
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 222798
:
147410
|
148117
|
155160