aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd
diff options
context:
space:
mode:
Diffstat (limited to 'fs/lockd')
-rw-r--r--fs/lockd/host.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 6d4aa8b3d610..c106d6a93e5d 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -53,8 +53,6 @@ struct nlm_lookup_host_info {
53 const u32 version; /* NLM version to search for */ 53 const u32 version; /* NLM version to search for */
54 const char *hostname; /* remote's hostname */ 54 const char *hostname; /* remote's hostname */
55 const size_t hostname_len; /* it's length */ 55 const size_t hostname_len; /* it's length */
56 const struct sockaddr *src_sap; /* our address (optional) */
57 const size_t src_len; /* it's length */
58 const int noresvport; /* use non-priv port */ 56 const int noresvport; /* use non-priv port */
59}; 57};
60 58
@@ -324,6 +322,8 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
324 struct sockaddr_in6 sin6 = { 322 struct sockaddr_in6 sin6 = {
325 .sin6_family = AF_INET6, 323 .sin6_family = AF_INET6,
326 }; 324 };
325 struct sockaddr *src_sap;
326 size_t src_len = rqstp->rq_addrlen;
327 struct nlm_lookup_host_info ni = { 327 struct nlm_lookup_host_info ni = {
328 .server = 1, 328 .server = 1,
329 .sap = svc_addr(rqstp), 329 .sap = svc_addr(rqstp),
@@ -332,7 +332,6 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
332 .version = rqstp->rq_vers, 332 .version = rqstp->rq_vers,
333 .hostname = hostname, 333 .hostname = hostname,
334 .hostname_len = hostname_len, 334 .hostname_len = hostname_len,
335 .src_len = rqstp->rq_addrlen,
336 }; 335 };
337 336
338 dprintk("lockd: %s(host='%*s', vers=%u, proto=%s)\n", __func__, 337 dprintk("lockd: %s(host='%*s', vers=%u, proto=%s)\n", __func__,
@@ -344,11 +343,11 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
344 switch (ni.sap->sa_family) { 343 switch (ni.sap->sa_family) {
345 case AF_INET: 344 case AF_INET:
346 sin.sin_addr.s_addr = rqstp->rq_daddr.addr.s_addr; 345 sin.sin_addr.s_addr = rqstp->rq_daddr.addr.s_addr;
347 ni.src_sap = (struct sockaddr *)&sin; 346 src_sap = (struct sockaddr *)&sin;
348 break; 347 break;
349 case AF_INET6: 348 case AF_INET6:
350 ipv6_addr_copy(&sin6.sin6_addr, &rqstp->rq_daddr.addr6); 349 ipv6_addr_copy(&sin6.sin6_addr, &rqstp->rq_daddr.addr6);
351 ni.src_sap = (struct sockaddr *)&sin6; 350 src_sap = (struct sockaddr *)&sin6;
352 break; 351 break;
353 default: 352 default:
354 dprintk("lockd: %s failed; unrecognized address family\n", 353 dprintk("lockd: %s failed; unrecognized address family\n",
@@ -372,7 +371,7 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
372 continue; 371 continue;
373 if (host->h_version != ni.version) 372 if (host->h_version != ni.version)
374 continue; 373 continue;
375 if (!rpc_cmp_addr(nlm_srcaddr(host), ni.src_sap)) 374 if (!rpc_cmp_addr(nlm_srcaddr(host), src_sap))
376 continue; 375 continue;
377 376
378 /* Move to head of hash chain. */ 377 /* Move to head of hash chain. */
@@ -389,8 +388,8 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
389 if (unlikely(host == NULL)) 388 if (unlikely(host == NULL))
390 goto out; 389 goto out;
391 390
392 memcpy(nlm_srcaddr(host), ni.src_sap, ni.src_len); 391 memcpy(nlm_srcaddr(host), src_sap, src_len);
393 host->h_srcaddrlen = ni.src_len; 392 host->h_srcaddrlen = src_len;
394 hlist_add_head(&host->h_hash, chain); 393 hlist_add_head(&host->h_hash, chain);
395 nrhosts++; 394 nrhosts++;
396 395