aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/lockd/clntlock.c2
-rw-r--r--fs/lockd/host.c11
-rw-r--r--include/linux/lockd/lockd.h16
3 files changed, 22 insertions, 7 deletions
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c
index 0b45fd3a4bfd..0df5587f804e 100644
--- a/fs/lockd/clntlock.c
+++ b/fs/lockd/clntlock.c
@@ -166,7 +166,7 @@ __be32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *lock
166 */ 166 */
167 if (fl_blocked->fl_u.nfs_fl.owner->pid != lock->svid) 167 if (fl_blocked->fl_u.nfs_fl.owner->pid != lock->svid)
168 continue; 168 continue;
169 if (!nlm_cmp_addr(&block->b_host->h_addr, addr)) 169 if (!nlm_cmp_addr(nlm_addr_in(block->b_host), addr))
170 continue; 170 continue;
171 if (nfs_compare_fh(NFS_FH(fl_blocked->fl_file->f_path.dentry->d_inode) ,fh) != 0) 171 if (nfs_compare_fh(NFS_FH(fl_blocked->fl_file->f_path.dentry->d_inode) ,fh) != 0)
172 continue; 172 continue;
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 008e4026f540..8c7022eeae65 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -116,7 +116,7 @@ static struct nlm_host *nlm_lookup_host(int server,
116 */ 116 */
117 chain = &nlm_hosts[hash]; 117 chain = &nlm_hosts[hash];
118 hlist_for_each_entry(host, pos, chain, h_hash) { 118 hlist_for_each_entry(host, pos, chain, h_hash) {
119 if (!nlm_cmp_addr(&host->h_addr, sin)) 119 if (!nlm_cmp_addr(nlm_addr_in(host), sin))
120 continue; 120 continue;
121 121
122 /* See if we have an NSM handle for this client */ 122 /* See if we have an NSM handle for this client */
@@ -165,8 +165,9 @@ static struct nlm_host *nlm_lookup_host(int server,
165 goto out; 165 goto out;
166 } 166 }
167 host->h_name = nsm->sm_name; 167 host->h_name = nsm->sm_name;
168 host->h_addr = *sin; 168 memcpy(nlm_addr(host), sin, sizeof(*sin));
169 nlm_clear_port((struct sockaddr *)&host->h_addr); 169 host->h_addrlen = sizeof(*sin);
170 nlm_clear_port(nlm_addr(host));
170 host->h_saddr = *ssin; 171 host->h_saddr = *ssin;
171 host->h_version = version; 172 host->h_version = version;
172 host->h_proto = proto; 173 host->h_proto = proto;
@@ -291,8 +292,8 @@ nlm_bind_host(struct nlm_host *host)
291 }; 292 };
292 struct rpc_create_args args = { 293 struct rpc_create_args args = {
293 .protocol = host->h_proto, 294 .protocol = host->h_proto,
294 .address = (struct sockaddr *)&host->h_addr, 295 .address = nlm_addr(host),
295 .addrsize = sizeof(host->h_addr), 296 .addrsize = host->h_addrlen,
296 .saddress = (struct sockaddr *)&host->h_saddr, 297 .saddress = (struct sockaddr *)&host->h_saddr,
297 .timeout = &timeparms, 298 .timeout = &timeparms,
298 .servername = host->h_name, 299 .servername = host->h_name,
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 0691efbd0b34..41d7a8e61cea 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -38,7 +38,8 @@
38 */ 38 */
39struct nlm_host { 39struct nlm_host {
40 struct hlist_node h_hash; /* doubly linked list */ 40 struct hlist_node h_hash; /* doubly linked list */
41 struct sockaddr_in h_addr; /* peer address */ 41 struct sockaddr_storage h_addr; /* peer address */
42 size_t h_addrlen;
42 struct sockaddr_in h_saddr; /* our address (optional) */ 43 struct sockaddr_in h_saddr; /* our address (optional) */
43 struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */ 44 struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */
44 char * h_name; /* remote hostname */ 45 char * h_name; /* remote hostname */
@@ -77,6 +78,19 @@ struct nsm_handle {
77}; 78};
78 79
79/* 80/*
81 * Rigorous type checking on sockaddr type conversions
82 */
83static inline struct sockaddr_in *nlm_addr_in(const struct nlm_host *host)
84{
85 return (struct sockaddr_in *)&host->h_addr;
86}
87
88static inline struct sockaddr *nlm_addr(const struct nlm_host *host)
89{
90 return (struct sockaddr *)&host->h_addr;
91}
92
93/*
80 * Map an fl_owner_t into a unique 32-bit "pid" 94 * Map an fl_owner_t into a unique 32-bit "pid"
81 */ 95 */
82struct nlm_lockowner { 96struct nlm_lockowner {