]> git.karo-electronics.de Git - linux-beck.git/commitdiff
NFS: Remove the BUG_ON() in the mount code
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 15 Oct 2012 20:25:42 +0000 (16:25 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Sun, 4 Nov 2012 19:43:39 +0000 (14:43 -0500)
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/mount_clnt.c

index 015f71f8f62c271ebcd6c6ec3949aeff446ce420..91a6faf811accb8e8e35ab6c3644e16058356a2a 100644 (file)
@@ -169,6 +169,9 @@ int nfs_mount(struct nfs_mount_request *info)
                (info->hostname ? info->hostname : "server"),
                        info->dirpath);
 
+       if (strlen(info->dirpath) > MNTPATHLEN)
+               return -ENAMETOOLONG;
+
        if (info->noresvport)
                args.flags |= RPC_CLNT_CREATE_NONPRIVPORT;
 
@@ -242,6 +245,9 @@ void nfs_umount(const struct nfs_mount_request *info)
        struct rpc_clnt *clnt;
        int status;
 
+       if (strlen(info->dirpath) > MNTPATHLEN)
+               return;
+
        if (info->noresvport)
                args.flags |= RPC_CLNT_CREATE_NONPRIVPORT;
 
@@ -283,7 +289,6 @@ static void encode_mntdirpath(struct xdr_stream *xdr, const char *pathname)
        const u32 pathname_len = strlen(pathname);
        __be32 *p;
 
-       BUG_ON(pathname_len > MNTPATHLEN);
        p = xdr_reserve_space(xdr, 4 + pathname_len);
        xdr_encode_opaque(p, pathname, pathname_len);
 }