aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfsctl.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2009-08-21 11:27:29 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-08-21 11:27:29 -0400
commite9dc122166b8d863d3057a66ada04838e5548e52 (patch)
tree749e15bf719b64bf9113db7acd8e043d9742cb26 /fs/nfsd/nfsctl.c
parent560ab42ef923aaf2e4347315bdfcc74b2708972c (diff)
parent405d8f8b1d936414da2093d4149ff790ff3f84a5 (diff)
Merge branch 'nfs-for-2.6.32' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6 into for-2.6.32-incoming
Conflicts: net/sunrpc/cache.c
Diffstat (limited to 'fs/nfsd/nfsctl.c')
-rw-r--r--fs/nfsd/nfsctl.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index b51e7ae8b570..b764d7d898e9 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -25,7 +25,6 @@
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/inet.h> 26#include <linux/inet.h>
27#include <linux/string.h> 27#include <linux/string.h>
28#include <linux/smp_lock.h>
29#include <linux/ctype.h> 28#include <linux/ctype.h>
30 29
31#include <linux/nfs.h> 30#include <linux/nfs.h>
@@ -38,6 +37,7 @@
38#include <linux/nfsd/xdr.h> 37#include <linux/nfsd/xdr.h>
39#include <linux/nfsd/syscall.h> 38#include <linux/nfsd/syscall.h>
40#include <linux/lockd/lockd.h> 39#include <linux/lockd/lockd.h>
40#include <linux/sunrpc/clnt.h>
41 41
42#include <asm/uaccess.h> 42#include <asm/uaccess.h>
43#include <net/ipv6.h> 43#include <net/ipv6.h>
@@ -491,22 +491,18 @@ static ssize_t write_getfd(struct file *file, char *buf, size_t size)
491 * 491 *
492 * Input: 492 * Input:
493 * buf: '\n'-terminated C string containing a 493 * buf: '\n'-terminated C string containing a
494 * presentation format IPv4 address 494 * presentation format IP address
495 * size: length of C string in @buf 495 * size: length of C string in @buf
496 * Output: 496 * Output:
497 * On success: returns zero if all specified locks were released; 497 * On success: returns zero if all specified locks were released;
498 * returns one if one or more locks were not released 498 * returns one if one or more locks were not released
499 * On error: return code is negative errno value 499 * On error: return code is negative errno value
500 *
501 * Note: Only AF_INET client addresses are passed in
502 */ 500 */
503static ssize_t write_unlock_ip(struct file *file, char *buf, size_t size) 501static ssize_t write_unlock_ip(struct file *file, char *buf, size_t size)
504{ 502{
505 struct sockaddr_in sin = { 503 struct sockaddr_storage address;
506 .sin_family = AF_INET, 504 struct sockaddr *sap = (struct sockaddr *)&address;
507 }; 505 size_t salen = sizeof(address);
508 int b1, b2, b3, b4;
509 char c;
510 char *fo_path; 506 char *fo_path;
511 507
512 /* sanity check */ 508 /* sanity check */
@@ -520,14 +516,10 @@ static ssize_t write_unlock_ip(struct file *file, char *buf, size_t size)
520 if (qword_get(&buf, fo_path, size) < 0) 516 if (qword_get(&buf, fo_path, size) < 0)
521 return -EINVAL; 517 return -EINVAL;
522 518
523 /* get ipv4 address */ 519 if (rpc_pton(fo_path, size, sap, salen) == 0)
524 if (sscanf(fo_path, "%u.%u.%u.%u%c", &b1, &b2, &b3, &b4, &c) != 4)
525 return -EINVAL;
526 if (b1 > 255 || b2 > 255 || b3 > 255 || b4 > 255)
527 return -EINVAL; 520 return -EINVAL;
528 sin.sin_addr.s_addr = htonl((b1 << 24) | (b2 << 16) | (b3 << 8) | b4);
529 521
530 return nlmsvc_unlock_all_by_ip((struct sockaddr *)&sin); 522 return nlmsvc_unlock_all_by_ip(sap);
531} 523}
532 524
533/** 525/**