diff options
Diffstat (limited to 'fs/nfsd/nfsctl.c')
-rw-r--r-- | fs/nfsd/nfsctl.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 3d93b2064ce5..a4ed8644d69c 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -938,10 +938,12 @@ static ssize_t __write_ports(struct file *file, char *buf, size_t size) | |||
938 | char transport[16]; | 938 | char transport[16]; |
939 | int port; | 939 | int port; |
940 | if (sscanf(buf, "%15s %4d", transport, &port) == 2) { | 940 | if (sscanf(buf, "%15s %4d", transport, &port) == 2) { |
941 | if (port < 1 || port > 65535) | ||
942 | return -EINVAL; | ||
941 | err = nfsd_create_serv(); | 943 | err = nfsd_create_serv(); |
942 | if (!err) { | 944 | if (!err) { |
943 | err = svc_create_xprt(nfsd_serv, | 945 | err = svc_create_xprt(nfsd_serv, |
944 | transport, port, | 946 | transport, PF_INET, port, |
945 | SVC_SOCK_ANONYMOUS); | 947 | SVC_SOCK_ANONYMOUS); |
946 | if (err == -ENOENT) | 948 | if (err == -ENOENT) |
947 | /* Give a reasonable perror msg for | 949 | /* Give a reasonable perror msg for |
@@ -960,7 +962,7 @@ static ssize_t __write_ports(struct file *file, char *buf, size_t size) | |||
960 | char transport[16]; | 962 | char transport[16]; |
961 | int port; | 963 | int port; |
962 | if (sscanf(&buf[1], "%15s %4d", transport, &port) == 2) { | 964 | if (sscanf(&buf[1], "%15s %4d", transport, &port) == 2) { |
963 | if (port == 0) | 965 | if (port < 1 || port > 65535) |
964 | return -EINVAL; | 966 | return -EINVAL; |
965 | if (nfsd_serv) { | 967 | if (nfsd_serv) { |
966 | xprt = svc_find_xprt(nfsd_serv, transport, | 968 | xprt = svc_find_xprt(nfsd_serv, transport, |