aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/nfs4xdr.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 646f16da0722..1750d996f49f 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -2408,8 +2408,10 @@ static int decode_pathname(struct xdr_stream *xdr, struct nfs4_pathname *path)
2408 2408
2409 READ_BUF(4); 2409 READ_BUF(4);
2410 READ32(n); 2410 READ32(n);
2411 if (n <= 0) 2411 if (n < 0)
2412 goto out_eio; 2412 goto out_eio;
2413 if (n == 0)
2414 goto root_path;
2413 dprintk("path "); 2415 dprintk("path ");
2414 path->ncomponents = 0; 2416 path->ncomponents = 0;
2415 while (path->ncomponents < n) { 2417 while (path->ncomponents < n) {
@@ -2430,6 +2432,13 @@ static int decode_pathname(struct xdr_stream *xdr, struct nfs4_pathname *path)
2430out: 2432out:
2431 dprintk("\n"); 2433 dprintk("\n");
2432 return status; 2434 return status;
2435root_path:
2436/* a root pathname is sent as a zero component4 */
2437 path->ncomponents = 1;
2438 path->components[0].len=0;
2439 path->components[0].data=NULL;
2440 dprintk("path /\n");
2441 goto out;
2433out_eio: 2442out_eio:
2434 dprintk(" status %d", status); 2443 dprintk(" status %d", status);
2435 status = -EIO; 2444 status = -EIO;