Skip to content

Commit 576df46

Browse files
chuckleverJ. Bruce Fields
authored andcommitted
NLM: Decode "priv" argument of NLMPROC_SM_NOTIFY as an opaque
The NLM XDR decoders for the NLMPROC_SM_NOTIFY procedure should treat their "priv" argument truly as an opaque, as defined by the protocol, and let the upper layers figure out what is in it. This will make it easier to modify the contents and interpretation of the "priv" argument, and keep knowledge about what's in "priv" local to fs/lockd/mon.c. For now, the NLM and NSM implementations should behave exactly as they did before. The formation of the address of the rebooted host in nlm_host_rebooted() may look a little strange, but it is the inverse of how nsm_init_private() forms the private cookie. Plus, it's going away soon anyway. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
1 parent 7fefc9c commit 576df46

4 files changed

Lines changed: 10 additions & 9 deletions

File tree

‎fs/lockd/host.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,10 @@ void nlm_release_host(struct nlm_host *host)
453453
*/
454454
void nlm_host_rebooted(const struct nlm_reboot *info)
455455
{
456+
__be32 *p = (__be32 *)&info->priv.data;
456457
const struct sockaddr_in sin = {
457458
.sin_family = AF_INET,
458-
.sin_addr.s_addr = info->addr,
459+
.sin_addr.s_addr = *p,
459460
};
460461
struct hlist_head *chain;
461462
struct hlist_node *pos;

‎fs/lockd/xdr.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp)
349349
if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN)))
350350
return 0;
351351
argp->state = ntohl(*p++);
352-
/* Preserve the address in network byte order */
353-
argp->addr = *p++;
352+
memcpy(&argp->priv.data, p, sizeof(argp->priv.data));
353+
p += XDR_QUADLEN(SM_PRIV_SIZE);
354354
return xdr_argsize_check(rqstp, p);
355355
}
356356

‎fs/lockd/xdr4.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ nlm4svc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp
356356
if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN)))
357357
return 0;
358358
argp->state = ntohl(*p++);
359-
/* Preserve the address in network byte order */
360-
argp->addr = *p++;
359+
memcpy(&argp->priv.data, p, sizeof(argp->priv.data));
360+
p += XDR_QUADLEN(SM_PRIV_SIZE);
361361
return xdr_argsize_check(rqstp, p);
362362
}
363363

‎include/linux/lockd/xdr.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ struct nlm_res {
8383
* statd callback when client has rebooted
8484
*/
8585
struct nlm_reboot {
86-
char * mon;
87-
unsigned int len;
88-
u32 state;
89-
__be32 addr;
86+
char *mon;
87+
unsigned int len;
88+
u32 state;
89+
struct nsm_private priv;
9090
};
9191

9292
/*

0 commit comments

Comments
 (0)