diff options
-rw-r--r-- | fs/lockd/host.c | 5 | ||||
-rw-r--r-- | fs/lockd/mon.c | 2 | ||||
-rw-r--r-- | include/linux/lockd/lockd.h | 13 |
3 files changed, 16 insertions, 4 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 3ce2702d0368..510ebcf485f0 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
@@ -551,7 +551,7 @@ retry: | |||
551 | if (strlen(pos->sm_name) != hostname_len | 551 | if (strlen(pos->sm_name) != hostname_len |
552 | || memcmp(pos->sm_name, hostname, hostname_len)) | 552 | || memcmp(pos->sm_name, hostname, hostname_len)) |
553 | continue; | 553 | continue; |
554 | } else if (!nlm_cmp_addr(&pos->sm_addr, sin)) | 554 | } else if (!nlm_cmp_addr(nsm_addr_in(pos), sin)) |
555 | continue; | 555 | continue; |
556 | atomic_inc(&pos->sm_count); | 556 | atomic_inc(&pos->sm_count); |
557 | kfree(nsm); | 557 | kfree(nsm); |
@@ -571,7 +571,8 @@ retry: | |||
571 | if (nsm == NULL) | 571 | if (nsm == NULL) |
572 | return NULL; | 572 | return NULL; |
573 | 573 | ||
574 | nsm->sm_addr = *sin; | 574 | memcpy(nsm_addr(nsm), sin, sizeof(*sin)); |
575 | nsm->sm_addrlen = sizeof(*sin); | ||
575 | nsm->sm_name = (char *) (nsm + 1); | 576 | nsm->sm_name = (char *) (nsm + 1); |
576 | memcpy(nsm->sm_name, hostname, hostname_len); | 577 | memcpy(nsm->sm_name, hostname, hostname_len); |
577 | nsm->sm_name[hostname_len] = '\0'; | 578 | nsm->sm_name[hostname_len] = '\0'; |
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c index e4d563543b11..4e7e958e8f67 100644 --- a/fs/lockd/mon.c +++ b/fs/lockd/mon.c | |||
@@ -51,7 +51,7 @@ nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res) | |||
51 | 51 | ||
52 | memset(&args, 0, sizeof(args)); | 52 | memset(&args, 0, sizeof(args)); |
53 | args.mon_name = nsm->sm_name; | 53 | args.mon_name = nsm->sm_name; |
54 | args.addr = nsm->sm_addr.sin_addr.s_addr; | 54 | args.addr = nsm_addr_in(nsm)->sin_addr.s_addr; |
55 | args.prog = NLM_PROGRAM; | 55 | args.prog = NLM_PROGRAM; |
56 | args.vers = 3; | 56 | args.vers = 3; |
57 | args.proc = NLMPROC_NSM_NOTIFY; | 57 | args.proc = NLMPROC_NSM_NOTIFY; |
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index 964e6c93830f..b1dfa0b1d1bc 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h | |||
@@ -71,7 +71,8 @@ struct nsm_handle { | |||
71 | struct list_head sm_link; | 71 | struct list_head sm_link; |
72 | atomic_t sm_count; | 72 | atomic_t sm_count; |
73 | char * sm_name; | 73 | char * sm_name; |
74 | struct sockaddr_in sm_addr; | 74 | struct sockaddr_storage sm_addr; |
75 | size_t sm_addrlen; | ||
75 | unsigned int sm_monitored : 1, | 76 | unsigned int sm_monitored : 1, |
76 | sm_sticky : 1; /* don't unmonitor */ | 77 | sm_sticky : 1; /* don't unmonitor */ |
77 | char sm_addrbuf[48]; /* address eyecatcher */ | 78 | char sm_addrbuf[48]; /* address eyecatcher */ |
@@ -100,6 +101,16 @@ static inline struct sockaddr *nlm_srcaddr(const struct nlm_host *host) | |||
100 | return (struct sockaddr *)&host->h_srcaddr; | 101 | return (struct sockaddr *)&host->h_srcaddr; |
101 | } | 102 | } |
102 | 103 | ||
104 | static inline struct sockaddr_in *nsm_addr_in(const struct nsm_handle *handle) | ||
105 | { | ||
106 | return (struct sockaddr_in *)&handle->sm_addr; | ||
107 | } | ||
108 | |||
109 | static inline struct sockaddr *nsm_addr(const struct nsm_handle *handle) | ||
110 | { | ||
111 | return (struct sockaddr *)&handle->sm_addr; | ||
112 | } | ||
113 | |||
103 | /* | 114 | /* |
104 | * Map an fl_owner_t into a unique 32-bit "pid" | 115 | * Map an fl_owner_t into a unique 32-bit "pid" |
105 | */ | 116 | */ |