hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/fs/lockd/host.c
....@@ -60,6 +60,7 @@
6060 const size_t hostname_len; /* it's length */
6161 const int noresvport; /* use non-priv port */
6262 struct net *net; /* network namespace to bind */
63
+ const struct cred *cred;
6364 };
6465
6566 /*
....@@ -162,6 +163,7 @@
162163 host->h_nsmhandle = nsm;
163164 host->h_addrbuf = nsm->sm_addrbuf;
164165 host->net = ni->net;
166
+ host->h_cred = get_cred(ni->cred),
165167 strlcpy(host->nodename, utsname()->nodename, sizeof(host->nodename));
166168
167169 out:
....@@ -188,6 +190,7 @@
188190 clnt = host->h_rpcclnt;
189191 if (clnt != NULL)
190192 rpc_shutdown_client(clnt);
193
+ put_cred(host->h_cred);
191194 kfree(host);
192195
193196 ln->nrhosts--;
....@@ -202,6 +205,8 @@
202205 * @version: NLM protocol version
203206 * @hostname: '\0'-terminated hostname of server
204207 * @noresvport: 1 if non-privileged port should be used
208
+ * @net: pointer to net namespace
209
+ * @cred: pointer to cred
205210 *
206211 * Returns an nlm_host structure that matches the passed-in
207212 * [server address, transport protocol, NLM version, server hostname].
....@@ -214,7 +219,8 @@
214219 const u32 version,
215220 const char *hostname,
216221 int noresvport,
217
- struct net *net)
222
+ struct net *net,
223
+ const struct cred *cred)
218224 {
219225 struct nlm_lookup_host_info ni = {
220226 .server = 0,
....@@ -226,6 +232,7 @@
226232 .hostname_len = strlen(hostname),
227233 .noresvport = noresvport,
228234 .net = net,
235
+ .cred = cred,
229236 };
230237 struct hlist_head *chain;
231238 struct nlm_host *host;
....@@ -452,7 +459,9 @@
452459 .version = host->h_version,
453460 .authflavor = RPC_AUTH_UNIX,
454461 .flags = (RPC_CLNT_CREATE_NOPING |
455
- RPC_CLNT_CREATE_AUTOBIND),
462
+ RPC_CLNT_CREATE_AUTOBIND |
463
+ RPC_CLNT_CREATE_REUSEPORT),
464
+ .cred = host->h_cred,
456465 };
457466
458467 /*