mirror of
https://github.com/torvalds/linux.git
synced 2024-12-26 04:42:12 +00:00
NFS client fixes for Linux 5.2
Stable bugfixes: - SUNRPC: Fix regression in umount of a secure mount - SUNRPC: Fix a use after free when a server rejects the RPCSEC_GSS credential - NFSv4.1: Again fix a race where CB_NOTIFY_LOCK fails to wake a waiter - NFSv4.1: Fix bug only first CB_NOTIFY_LOCK is handled Other bugfixes: - xprtrdma: Use struct_size() in kzalloc() -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEnZ5MQTpR7cLU7KEp18tUv7ClQOsFAlz4KzoACgkQ18tUv7Cl QOt7OhAAvG+DVZ6V5+q4zvabKgoievlL56Ys4SaAp3+OlxC6VaiyQUDs/6U9C/xH dmVbGYWdFXjqJE1JPXxmu0jOdRiZcnhIq+hiHNOK0qZOBCnE5zzZ1r1tdNY0GHQ2 JOkREqsXsaeUWuO0pCY7JOmzd5aU1XLhg1/8+9Z7gNwamMfwLkEqi7FGtXi+xsGz gQVxMJlHsV2F21IKdKS0TJrcqr2okya/MnOQRbbMC2RT/MYNxDrhAPBJ1Shcx3HB NlccAn4jhIL0bCPRvFPib6KrO01U0Ye/KECN8j2qHRT4QS2s0dsnnQ6f2tEs9mJ8 cRTVh1uniF6ZuDxSr6KIIN3mKA9DX2SK83H16ahAaRBLM8dwF+4MIr6gDdtJvsVw nY0YDpnAaKFypuCPBV/jFu7fk97hul4ntymJGVeFdlqu/HtWs1Z1iM93DDVJbKr8 a3AND6woOQ2asvySPo+X66PKt79gofga4C+ZDuMfJax8+K9imqIyforgLrAmd/yL sGAlLzenf6fmOB5C1bPTtrFFbs6XiHXMidDGwmm1kOZIDuN+O2TTwc24gyXx0IyJ OhmjDn2CKmzS2WVPhetRgurzkdTigJu4PebC421qWSFhxlf/NfghW+rpM9su/hwv /r9+bpdjZ8YD5FUJvxsX4NZLr+SWbNTzX/ARNdRFsGr0NLpG/50= =rrp/ -----END PGP SIGNATURE----- Merge tag 'nfs-for-5.2-2' of git://git.linux-nfs.org/projects/anna/linux-nfs Pull NFS client fixes from Anna Schumaker: "These are mostly stable bugfixes found during testing, many during the recent NFS bake-a-thon. Stable bugfixes: - SUNRPC: Fix regression in umount of a secure mount - SUNRPC: Fix a use after free when a server rejects the RPCSEC_GSS credential - NFSv4.1: Again fix a race where CB_NOTIFY_LOCK fails to wake a waiter - NFSv4.1: Fix bug only first CB_NOTIFY_LOCK is handled Other bugfixes: - xprtrdma: Use struct_size() in kzalloc()" * tag 'nfs-for-5.2-2' of git://git.linux-nfs.org/projects/anna/linux-nfs: NFSv4.1: Fix bug only first CB_NOTIFY_LOCK is handled NFSv4.1: Again fix a race where CB_NOTIFY_LOCK fails to wake a waiter SUNRPC: Fix a use after free when a server rejects the RPCSEC_GSS credential SUNRPC fix regression in umount of a secure mount xprtrdma: Use struct_size() in kzalloc()
This commit is contained in:
commit
459aa077a2
@ -6932,7 +6932,6 @@ struct nfs4_lock_waiter {
|
||||
struct task_struct *task;
|
||||
struct inode *inode;
|
||||
struct nfs_lowner *owner;
|
||||
bool notified;
|
||||
};
|
||||
|
||||
static int
|
||||
@ -6954,13 +6953,13 @@ nfs4_wake_lock_waiter(wait_queue_entry_t *wait, unsigned int mode, int flags, vo
|
||||
/* Make sure it's for the right inode */
|
||||
if (nfs_compare_fh(NFS_FH(waiter->inode), &cbnl->cbnl_fh))
|
||||
return 0;
|
||||
|
||||
waiter->notified = true;
|
||||
}
|
||||
|
||||
/* override "private" so we can use default_wake_function */
|
||||
wait->private = waiter->task;
|
||||
ret = autoremove_wake_function(wait, mode, flags, key);
|
||||
ret = woken_wake_function(wait, mode, flags, key);
|
||||
if (ret)
|
||||
list_del_init(&wait->entry);
|
||||
wait->private = waiter;
|
||||
return ret;
|
||||
}
|
||||
@ -6969,7 +6968,6 @@ static int
|
||||
nfs4_retry_setlk(struct nfs4_state *state, int cmd, struct file_lock *request)
|
||||
{
|
||||
int status = -ERESTARTSYS;
|
||||
unsigned long flags;
|
||||
struct nfs4_lock_state *lsp = request->fl_u.nfs4_fl.owner;
|
||||
struct nfs_server *server = NFS_SERVER(state->inode);
|
||||
struct nfs_client *clp = server->nfs_client;
|
||||
@ -6979,8 +6977,7 @@ nfs4_retry_setlk(struct nfs4_state *state, int cmd, struct file_lock *request)
|
||||
.s_dev = server->s_dev };
|
||||
struct nfs4_lock_waiter waiter = { .task = current,
|
||||
.inode = state->inode,
|
||||
.owner = &owner,
|
||||
.notified = false };
|
||||
.owner = &owner};
|
||||
wait_queue_entry_t wait;
|
||||
|
||||
/* Don't bother with waitqueue if we don't expect a callback */
|
||||
@ -6990,27 +6987,22 @@ nfs4_retry_setlk(struct nfs4_state *state, int cmd, struct file_lock *request)
|
||||
init_wait(&wait);
|
||||
wait.private = &waiter;
|
||||
wait.func = nfs4_wake_lock_waiter;
|
||||
add_wait_queue(q, &wait);
|
||||
|
||||
while(!signalled()) {
|
||||
waiter.notified = false;
|
||||
add_wait_queue(q, &wait);
|
||||
status = nfs4_proc_setlk(state, cmd, request);
|
||||
if ((status != -EAGAIN) || IS_SETLK(cmd))
|
||||
if ((status != -EAGAIN) || IS_SETLK(cmd)) {
|
||||
finish_wait(q, &wait);
|
||||
break;
|
||||
}
|
||||
|
||||
status = -ERESTARTSYS;
|
||||
spin_lock_irqsave(&q->lock, flags);
|
||||
if (waiter.notified) {
|
||||
spin_unlock_irqrestore(&q->lock, flags);
|
||||
continue;
|
||||
}
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
spin_unlock_irqrestore(&q->lock, flags);
|
||||
|
||||
freezable_schedule_timeout(NFS4_LOCK_MAXTIMEOUT);
|
||||
freezer_do_not_count();
|
||||
wait_woken(&wait, TASK_INTERRUPTIBLE, NFS4_LOCK_MAXTIMEOUT);
|
||||
freezer_count();
|
||||
finish_wait(q, &wait);
|
||||
}
|
||||
|
||||
finish_wait(q, &wait);
|
||||
return status;
|
||||
}
|
||||
#else /* !CONFIG_NFS_V4_1 */
|
||||
|
@ -2288,13 +2288,13 @@ call_status(struct rpc_task *task)
|
||||
case -ECONNREFUSED:
|
||||
case -ECONNRESET:
|
||||
case -ECONNABORTED:
|
||||
case -ENOTCONN:
|
||||
rpc_force_rebind(clnt);
|
||||
/* fall through */
|
||||
case -EADDRINUSE:
|
||||
rpc_delay(task, 3*HZ);
|
||||
/* fall through */
|
||||
case -EPIPE:
|
||||
case -ENOTCONN:
|
||||
case -EAGAIN:
|
||||
break;
|
||||
case -EIO:
|
||||
@ -2426,17 +2426,21 @@ call_decode(struct rpc_task *task)
|
||||
return;
|
||||
case -EAGAIN:
|
||||
task->tk_status = 0;
|
||||
/* Note: rpc_decode_header() may have freed the RPC slot */
|
||||
if (task->tk_rqstp == req) {
|
||||
xdr_free_bvec(&req->rq_rcv_buf);
|
||||
req->rq_reply_bytes_recvd = 0;
|
||||
req->rq_rcv_buf.len = 0;
|
||||
if (task->tk_client->cl_discrtry)
|
||||
xprt_conditional_disconnect(req->rq_xprt,
|
||||
req->rq_connect_cookie);
|
||||
}
|
||||
xdr_free_bvec(&req->rq_rcv_buf);
|
||||
req->rq_reply_bytes_recvd = 0;
|
||||
req->rq_rcv_buf.len = 0;
|
||||
if (task->tk_client->cl_discrtry)
|
||||
xprt_conditional_disconnect(req->rq_xprt,
|
||||
req->rq_connect_cookie);
|
||||
task->tk_action = call_encode;
|
||||
rpc_check_timeout(task);
|
||||
break;
|
||||
case -EKEYREJECTED:
|
||||
task->tk_action = call_reserve;
|
||||
rpc_check_timeout(task);
|
||||
rpcauth_invalcred(task);
|
||||
/* Ensure we obtain a new XID if we retry! */
|
||||
xprt_release(task);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2572,11 +2576,7 @@ out_msg_denied:
|
||||
break;
|
||||
task->tk_cred_retry--;
|
||||
trace_rpc__stale_creds(task);
|
||||
rpcauth_invalcred(task);
|
||||
/* Ensure we obtain a new XID! */
|
||||
xprt_release(task);
|
||||
task->tk_action = call_reserve;
|
||||
return -EAGAIN;
|
||||
return -EKEYREJECTED;
|
||||
case rpc_autherr_badcred:
|
||||
case rpc_autherr_badverf:
|
||||
/* possibly garbled cred/verf? */
|
||||
|
@ -810,8 +810,7 @@ static struct rpcrdma_sendctx *rpcrdma_sendctx_create(struct rpcrdma_ia *ia)
|
||||
{
|
||||
struct rpcrdma_sendctx *sc;
|
||||
|
||||
sc = kzalloc(sizeof(*sc) +
|
||||
ia->ri_max_send_sges * sizeof(struct ib_sge),
|
||||
sc = kzalloc(struct_size(sc, sc_sges, ia->ri_max_send_sges),
|
||||
GFP_KERNEL);
|
||||
if (!sc)
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user