Skip to content

Commit 58df9b3

Browse files
committed
Merge tag 'nfs-for-3.4-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Pull NFS client bugfixes for Linux 3.4 from Trond Myklebust Highlights include: - Fix infinite loops in the mount code - Fix a userspace buffer overflow in __nfs4_get_acl_uncached - Fix a memory leak due to a double reference count in rpcb_getport_async() Signed-off-by: Trond Myklebust <[email protected]> * tag 'nfs-for-3.4-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: NFSv4: Minor cleanups for nfs4_handle_exception and nfs4_async_handle_error NFSv4.1: Fix layoutcommit error handling NFSv4: Fix two infinite loops in the mount code SUNRPC: Use the already looked-up xprt in rpcb_getport_async() NFS4.1: remove duplicate variable declaration in filelayout_clear_request_commit Fix length of buffer copied in __nfs4_get_acl_uncached
2 parents 8563f87 + 1497748 commit 58df9b3

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

fs/nfs/nfs4filelayout.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,6 @@ filelayout_clear_request_commit(struct nfs_page *req)
793793
if (!test_and_clear_bit(PG_COMMIT_TO_DS, &req->wb_flags))
794794
goto out;
795795
if (list_is_singular(&req->wb_list)) {
796-
struct inode *inode = req->wb_context->dentry->d_inode;
797796
struct pnfs_layout_segment *lseg;
798797

799798
/* From here we can find the bucket, but for the moment,

fs/nfs/nfs4proc.c

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ static int nfs4_handle_exception(struct nfs_server *server, int errorcode, struc
270270
case 0:
271271
return 0;
272272
case -NFS4ERR_OPENMODE:
273-
if (nfs_have_delegation(inode, FMODE_READ)) {
273+
if (inode && nfs_have_delegation(inode, FMODE_READ)) {
274274
nfs_inode_return_delegation(inode);
275275
exception->retry = 1;
276276
return 0;
@@ -282,10 +282,9 @@ static int nfs4_handle_exception(struct nfs_server *server, int errorcode, struc
282282
case -NFS4ERR_DELEG_REVOKED:
283283
case -NFS4ERR_ADMIN_REVOKED:
284284
case -NFS4ERR_BAD_STATEID:
285-
if (state != NULL)
286-
nfs_remove_bad_delegation(state->inode);
287285
if (state == NULL)
288286
break;
287+
nfs_remove_bad_delegation(state->inode);
289288
nfs4_schedule_stateid_recovery(server, state);
290289
goto wait_on_recovery;
291290
case -NFS4ERR_EXPIRED:
@@ -2290,11 +2289,12 @@ static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
22902289
switch (err) {
22912290
case 0:
22922291
case -NFS4ERR_WRONGSEC:
2293-
break;
2292+
goto out;
22942293
default:
22952294
err = nfs4_handle_exception(server, err, &exception);
22962295
}
22972296
} while (exception.retry);
2297+
out:
22982298
return err;
22992299
}
23002300

@@ -3712,7 +3712,7 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu
37123712
if (acl_len > buflen)
37133713
goto out_free;
37143714
_copy_from_pages(buf, pages, res.acl_data_offset,
3715-
res.acl_len);
3715+
acl_len);
37163716
}
37173717
ret = acl_len;
37183718
out_free:
@@ -3824,8 +3824,9 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server,
38243824
case -NFS4ERR_DELEG_REVOKED:
38253825
case -NFS4ERR_ADMIN_REVOKED:
38263826
case -NFS4ERR_BAD_STATEID:
3827-
if (state != NULL)
3828-
nfs_remove_bad_delegation(state->inode);
3827+
if (state == NULL)
3828+
break;
3829+
nfs_remove_bad_delegation(state->inode);
38293830
case -NFS4ERR_OPENMODE:
38303831
if (state == NULL)
38313832
break;
@@ -6111,21 +6112,22 @@ nfs4_layoutcommit_done(struct rpc_task *task, void *calldata)
61116112
return;
61126113

61136114
switch (task->tk_status) { /* Just ignore these failures */
6114-
case NFS4ERR_DELEG_REVOKED: /* layout was recalled */
6115-
case NFS4ERR_BADIOMODE: /* no IOMODE_RW layout for range */
6116-
case NFS4ERR_BADLAYOUT: /* no layout */
6117-
case NFS4ERR_GRACE: /* loca_recalim always false */
6115+
case -NFS4ERR_DELEG_REVOKED: /* layout was recalled */
6116+
case -NFS4ERR_BADIOMODE: /* no IOMODE_RW layout for range */
6117+
case -NFS4ERR_BADLAYOUT: /* no layout */
6118+
case -NFS4ERR_GRACE: /* loca_recalim always false */
61186119
task->tk_status = 0;
6119-
}
6120-
6121-
if (nfs4_async_handle_error(task, server, NULL) == -EAGAIN) {
6122-
rpc_restart_call_prepare(task);
6123-
return;
6124-
}
6125-
6126-
if (task->tk_status == 0)
6120+
break;
6121+
case 0:
61276122
nfs_post_op_update_inode_force_wcc(data->args.inode,
61286123
data->res.fattr);
6124+
break;
6125+
default:
6126+
if (nfs4_async_handle_error(task, server, NULL) == -EAGAIN) {
6127+
rpc_restart_call_prepare(task);
6128+
return;
6129+
}
6130+
}
61296131
}
61306132

61316133
static void nfs4_layoutcommit_release(void *calldata)
@@ -6229,11 +6231,12 @@ nfs41_proc_secinfo_no_name(struct nfs_server *server, struct nfs_fh *fhandle,
62296231
case 0:
62306232
case -NFS4ERR_WRONGSEC:
62316233
case -NFS4ERR_NOTSUPP:
6232-
break;
6234+
goto out;
62336235
default:
62346236
err = nfs4_handle_exception(server, err, &exception);
62356237
}
62366238
} while (exception.retry);
6239+
out:
62376240
return err;
62386241
}
62396242

net/sunrpc/rpcb_clnt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ void rpcb_getport_async(struct rpc_task *task)
734734
map->r_vers = clnt->cl_vers;
735735
map->r_prot = xprt->prot;
736736
map->r_port = 0;
737-
map->r_xprt = xprt_get(xprt);
737+
map->r_xprt = xprt;
738738
map->r_status = -EIO;
739739

740740
switch (bind_version) {

0 commit comments

Comments
 (0)