Commit 0a87cf128f3d3bc6aa7b1040e73109c974ed875a

Authored by Jeff Layton
Committed by Trond Myklebust
1 parent f9d888fcd9

NFSv4: handle lack of clientaddr in option string

If a NFSv4 mount is attempted  with string based options, and the
option string doesn't contain a clientaddr= option, the kernel will
currently oops. Check for this situation and return a proper error.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

Showing 1 changed file with 7 additions and 0 deletions Side-by-side Diff

... ... @@ -1685,6 +1685,9 @@
1685 1685  
1686 1686 dprintk("MNTPATH: %s\n", *mntpath);
1687 1687  
  1688 + if (args.client_address == NULL)
  1689 + goto out_no_client_address;
  1690 +
1688 1691 *ip_addr = args.client_address;
1689 1692  
1690 1693 break;
... ... @@ -1704,6 +1707,10 @@
1704 1707  
1705 1708 out_no_address:
1706 1709 dfprintk(MOUNT, "NFS4: mount program didn't pass remote address\n");
  1710 + return -EINVAL;
  1711 +
  1712 +out_no_client_address:
  1713 + dfprintk(MOUNT, "NFS4: mount program didn't pass callback address\n");
1707 1714 return -EINVAL;
1708 1715 }
1709 1716