mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
nfsd-6.17 fixes:
- A correctness fix for delegated timestamps - Address an NFSD shutdown hang when LOCALIO is in use - Prevent a remotely exploitable crasher when TLS is in use These arrived too late to be included in the initial nfsd-6.17 pull request. -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEKLLlsBKG3yQ88j7+M2qzM29mf5cFAmiZ+UMACgkQM2qzM29m f5cevBAAgvdeL/4VUue/p7vZEHBtHr3HlaoPpGi/mhFh/f9rrKKs/osSP45uV/we tDq8k8f37S/PPAKu5Ts0BmJUVeI16ZvqYw1tXcq6Xifl+qYtowP9re/Xf+6Uln/5 ebVgqQDO8Zl6rEIZGen/iSp4oq/yk7g7n8XAlL2DzoMcfdju8q5mtyaqKiJtHhor lE69sI73v0lj1HLpy/NHdSOQQVAUmhBJQYSpDRGh6jlkWhm9T/U5CP79TBAJVLlx Jglhs7GQe0dlP6lLHD0tc7dZ/3LImICQBw2P7PdYaM3Dc1Y2y5uzSfKHnxZ4EHBr +uDOD8WFxzt/9WzIoXSCDeMe7KvA8lUnqzEV06Ov5H8h8fHQ1ClR7hhEom+32DKo 7IC61/MNP+TcWrar+ObucjtuBsuFC65IkPdRAQHUyh0U9rOjFV0Riye9RCMRHZFy JPOlfPaUK8wP9AR4O3o6+Aeq4nx49RKd9su4YM/sAl+NdmCZjUnXbryvqymHp99d Lmxq9VIIoNyhX0tEbwNx8aop97yOb+76yFGFzLCPFWwV46x1Q49WsTL+fY9xN2uj 6DAK6wJOMfQGmPFxHH1ttzryjBvCXcVS4SEgzR3UK6KMDYHjI6WE+y1PO/AV9Wae RJTHooz4Hsw3h80/yoleZ5YixEiXiQSUDuu7sUVAvksRpnbhFxs= =qWSE -----END PGP SIGNATURE----- Merge tag 'nfsd-6.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux Pull nfsd fixes from Chuck Lever: - A correctness fix for delegated timestamps - Address an NFSD shutdown hang when LOCALIO is in use - Prevent a remotely exploitable crasher when TLS is in use * tag 'nfsd-6.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: sunrpc: fix handling of server side tls alerts nfsd: avoid ref leak in nfsd_open_local_fh() nfsd: don't set the ctime on delegated atime updates
This commit is contained in:
commit
53e760d894
@ -103,10 +103,11 @@ nfsd_open_local_fh(struct net *net, struct auth_domain *dom,
|
||||
if (nfsd_file_get(new) == NULL)
|
||||
goto again;
|
||||
/*
|
||||
* Drop the ref we were going to install and the
|
||||
* one we were going to return.
|
||||
* Drop the ref we were going to install (both file and
|
||||
* net) and the one we were going to return (only file).
|
||||
*/
|
||||
nfsd_file_put(localio);
|
||||
nfsd_net_put(net);
|
||||
nfsd_file_put(localio);
|
||||
localio = new;
|
||||
}
|
||||
|
@ -470,7 +470,15 @@ static int __nfsd_setattr(struct dentry *dentry, struct iattr *iap)
|
||||
if (!iap->ia_valid)
|
||||
return 0;
|
||||
|
||||
iap->ia_valid |= ATTR_CTIME;
|
||||
/*
|
||||
* If ATTR_DELEG is set, then this is an update from a client that
|
||||
* holds a delegation. If this is an update for only the atime, the
|
||||
* ctime should not be changed. If the update contains the mtime
|
||||
* too, then ATTR_CTIME should already be set.
|
||||
*/
|
||||
if (!(iap->ia_valid & ATTR_DELEG))
|
||||
iap->ia_valid |= ATTR_CTIME;
|
||||
|
||||
return notify_change(&nop_mnt_idmap, dentry, iap, NULL);
|
||||
}
|
||||
|
||||
|
@ -257,20 +257,47 @@ svc_tcp_sock_process_cmsg(struct socket *sock, struct msghdr *msg,
|
||||
}
|
||||
|
||||
static int
|
||||
svc_tcp_sock_recv_cmsg(struct svc_sock *svsk, struct msghdr *msg)
|
||||
svc_tcp_sock_recv_cmsg(struct socket *sock, unsigned int *msg_flags)
|
||||
{
|
||||
union {
|
||||
struct cmsghdr cmsg;
|
||||
u8 buf[CMSG_SPACE(sizeof(u8))];
|
||||
} u;
|
||||
struct socket *sock = svsk->sk_sock;
|
||||
u8 alert[2];
|
||||
struct kvec alert_kvec = {
|
||||
.iov_base = alert,
|
||||
.iov_len = sizeof(alert),
|
||||
};
|
||||
struct msghdr msg = {
|
||||
.msg_flags = *msg_flags,
|
||||
.msg_control = &u,
|
||||
.msg_controllen = sizeof(u),
|
||||
};
|
||||
int ret;
|
||||
|
||||
msg->msg_control = &u;
|
||||
msg->msg_controllen = sizeof(u);
|
||||
iov_iter_kvec(&msg.msg_iter, ITER_DEST, &alert_kvec, 1,
|
||||
alert_kvec.iov_len);
|
||||
ret = sock_recvmsg(sock, &msg, MSG_DONTWAIT);
|
||||
if (ret > 0 &&
|
||||
tls_get_record_type(sock->sk, &u.cmsg) == TLS_RECORD_TYPE_ALERT) {
|
||||
iov_iter_revert(&msg.msg_iter, ret);
|
||||
ret = svc_tcp_sock_process_cmsg(sock, &msg, &u.cmsg, -EAGAIN);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
svc_tcp_sock_recvmsg(struct svc_sock *svsk, struct msghdr *msg)
|
||||
{
|
||||
int ret;
|
||||
struct socket *sock = svsk->sk_sock;
|
||||
|
||||
ret = sock_recvmsg(sock, msg, MSG_DONTWAIT);
|
||||
if (unlikely(msg->msg_controllen != sizeof(u)))
|
||||
ret = svc_tcp_sock_process_cmsg(sock, msg, &u.cmsg, ret);
|
||||
if (msg->msg_flags & MSG_CTRUNC) {
|
||||
msg->msg_flags &= ~(MSG_CTRUNC | MSG_EOR);
|
||||
if (ret == 0 || ret == -EIO)
|
||||
ret = svc_tcp_sock_recv_cmsg(sock, &msg->msg_flags);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -321,7 +348,7 @@ static ssize_t svc_tcp_read_msg(struct svc_rqst *rqstp, size_t buflen,
|
||||
iov_iter_advance(&msg.msg_iter, seek);
|
||||
buflen -= seek;
|
||||
}
|
||||
len = svc_tcp_sock_recv_cmsg(svsk, &msg);
|
||||
len = svc_tcp_sock_recvmsg(svsk, &msg);
|
||||
if (len > 0)
|
||||
svc_flush_bvec(bvec, len, seek);
|
||||
|
||||
@ -1018,7 +1045,7 @@ static ssize_t svc_tcp_read_marker(struct svc_sock *svsk,
|
||||
iov.iov_base = ((char *)&svsk->sk_marker) + svsk->sk_tcplen;
|
||||
iov.iov_len = want;
|
||||
iov_iter_kvec(&msg.msg_iter, ITER_DEST, &iov, 1, want);
|
||||
len = svc_tcp_sock_recv_cmsg(svsk, &msg);
|
||||
len = svc_tcp_sock_recvmsg(svsk, &msg);
|
||||
if (len < 0)
|
||||
return len;
|
||||
svsk->sk_tcplen += len;
|
||||
|
Loading…
Reference in New Issue
Block a user