Looks good to me. -dros sd On Mar 24, 2011, at 5:29 PM, Trond Myklebust wrote: > On Thu, 2011-03-24 at 16:48 -0400, Weston Andros Adamson wrote: > >> diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c >> index 433204f..414c7e9 100644 >> --- a/fs/nfs/nfs4filelayoutdev.c >> +++ b/fs/nfs/nfs4filelayoutdev.c >> @@ -261,7 +261,7 @@ out: >> * Currently only support ipv4, and one multi-path address. >> */ >> static struct nfs4_pnfs_ds * >> -decode_and_add_ds(__be32 **pp, struct inode *inode) >> +decode_and_add_ds(struct xdr_stream *streamp, struct inode *inode) >> { >> struct nfs4_pnfs_ds *ds = NULL; >> char *buf; >> @@ -269,25 +269,34 @@ decode_and_add_ds(__be32 **pp, struct inode *inode) >> u32 ip_addr, port; >> int nlen, rlen, i; >> int tmp[2]; >> - __be32 *r_netid, *r_addr, *p = *pp; >> + __be32 *p; >> >> /* r_netid */ >> + p = xdr_inline_decode(streamp, 4); >> + if (unlikely(!p)) >> + goto out_err; >> nlen = be32_to_cpup(p++); >> - r_netid = p; >> - p += XDR_QUADLEN(nlen); >> >> - /* r_addr */ >> - rlen = be32_to_cpup(p++); >> - r_addr = p; >> - p += XDR_QUADLEN(rlen); >> - *pp = p; >> + p = xdr_inline_decode(streamp, nlen); >> + if (unlikely(!p)) >> + goto out_err; >> >> /* Check that netid is "tcp" */ >> - if (nlen != 3 || memcmp((char *)r_netid, "tcp", 3)) { >> + if (nlen != 3 || memcmp((char *)p, "tcp", 3)) { >> dprintk("%s: ERROR: non ipv4 TCP r_netid\n", __func__); >> goto out_err; >> } >> >> + /* r_addr */ >> + p = xdr_inline_decode(streamp, 4); >> + if (unlikely(!p)) >> + goto out_err; >> + rlen = be32_to_cpup(p); >> + >> + p = xdr_inline_decode(streamp, rlen); >> + if (unlikely(!p)) >> + goto out_err; >> + >> /* ipv6 length plus port is legal */ >> if (rlen > INET6_ADDRSTRLEN + 8) { >> dprintk("%s: Invalid address, length %d\n", __func__, >> @@ -295,8 +304,10 @@ decode_and_add_ds(__be32 **pp, struct inode *inode) >> goto out_err; >> } >> buf = kmalloc(rlen + 1, GFP_KERNEL); >> + if (unlikely(!buf)) >> + goto out_err; >> buf[rlen] = '\0'; >> - memcpy(buf, r_addr, rlen); >> + memcpy(buf, p, rlen); >> >> /* replace the port dots with dashes for the in4_pton() delimiter*/ >> for (i = 0; i < 2; i++) { > > I had a small conflict with this last hunk due to an existing patch in > the nfs-for-2.6.39 branch, but I think I've fixed it up correctly. > > Please check the nfs-for-2.6.39 branch on > git://git.linux-nfs.org/projects/trondmy/nfs-2.6.git > > -- > Trond Myklebust > Linux NFS client maintainer > > NetApp > Trond.Myklebust@xxxxxxxxxx > www.netapp.com > -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html