Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'nfs-for-5.13-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs

Pull NFS client bugfixes from Trond Myklebust:
"Highlights include:

Stable fixes:

- Fix use-after-free in nfs4_init_client()

Bugfixes:

- Fix deadlock between nfs4_evict_inode() and nfs4_opendata_get_inode()

- Fix second deadlock in nfs4_evict_inode()

- nfs4_proc_set_acl should not change the value of NFS_CAP_UIDGID_NOMAP

- Fix setting of the NFS_CAP_SECURITY_LABEL capability"

* tag 'nfs-for-5.13-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
NFSv4: Fix second deadlock in nfs4_evict_inode()
NFSv4: Fix deadlock between nfs4_evict_inode() and nfs4_opendata_get_inode()
NFS: FMODE_READ and friends are C macros, not enum types
NFS: Fix a potential NULL dereference in nfs_get_client()
NFS: Fix use-after-free in nfs4_init_client()
NFS: Ensure the NFS_CAP_SECURITY_LABEL capability is set when appropriate
NFSv4: nfs4_proc_set_acl needs to restore NFS_CAP_UIDGID_NOMAP on error.

+33 -13
+1 -1
fs/nfs/client.c
··· 406 406 407 407 if (cl_init->hostname == NULL) { 408 408 WARN_ON(1); 409 - return NULL; 409 + return ERR_PTR(-EINVAL); 410 410 } 411 411 412 412 /* see if the client already exists */
+1
fs/nfs/nfs4_fs.h
··· 205 205 struct inode *inode; 206 206 nfs4_stateid *stateid; 207 207 long timeout; 208 + unsigned char task_is_privileged : 1; 208 209 unsigned char delay : 1, 209 210 recovering : 1, 210 211 retry : 1;
+1 -1
fs/nfs/nfs4client.c
··· 435 435 */ 436 436 nfs_mark_client_ready(clp, -EPERM); 437 437 } 438 - nfs_put_client(clp); 439 438 clear_bit(NFS_CS_TSM_POSSIBLE, &clp->cl_flags); 439 + nfs_put_client(clp); 440 440 return old; 441 441 442 442 error:
+30 -7
fs/nfs/nfs4proc.c
··· 589 589 goto out_retry; 590 590 } 591 591 if (exception->recovering) { 592 + if (exception->task_is_privileged) 593 + return -EDEADLOCK; 592 594 ret = nfs4_wait_clnt_recover(clp); 593 595 if (test_bit(NFS_MIG_FAILED, &server->mig_status)) 594 596 return -EIO; ··· 616 614 goto out_retry; 617 615 } 618 616 if (exception->recovering) { 617 + if (exception->task_is_privileged) 618 + return -EDEADLOCK; 619 619 rpc_sleep_on(&clp->cl_rpcwaitq, task, NULL); 620 620 if (test_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) == 0) 621 621 rpc_wake_up_queued_task(&clp->cl_rpcwaitq, task); ··· 3882 3878 server->caps |= NFS_CAP_HARDLINKS; 3883 3879 if (res.has_symlinks != 0) 3884 3880 server->caps |= NFS_CAP_SYMLINKS; 3881 + #ifdef CONFIG_NFS_V4_SECURITY_LABEL 3882 + if (res.attr_bitmask[2] & FATTR4_WORD2_SECURITY_LABEL) 3883 + server->caps |= NFS_CAP_SECURITY_LABEL; 3884 + #endif 3885 3885 if (!(res.attr_bitmask[0] & FATTR4_WORD0_FILEID)) 3886 3886 server->fattr_valid &= ~NFS_ATTR_FATTR_FILEID; 3887 3887 if (!(res.attr_bitmask[1] & FATTR4_WORD1_MODE)) ··· 3906 3898 server->fattr_valid &= ~NFS_ATTR_FATTR_CTIME; 3907 3899 if (!(res.attr_bitmask[1] & FATTR4_WORD1_TIME_MODIFY)) 3908 3900 server->fattr_valid &= ~NFS_ATTR_FATTR_MTIME; 3909 - #ifdef CONFIG_NFS_V4_SECURITY_LABEL 3910 - if (!(res.attr_bitmask[2] & FATTR4_WORD2_SECURITY_LABEL)) 3911 - server->fattr_valid &= ~NFS_ATTR_FATTR_V4_SECURITY_LABEL; 3912 - #endif 3913 3901 memcpy(server->attr_bitmask_nl, res.attr_bitmask, 3914 3902 sizeof(server->attr_bitmask)); 3915 3903 server->attr_bitmask_nl[2] &= ~FATTR4_WORD2_SECURITY_LABEL; ··· 5972 5968 do { 5973 5969 err = __nfs4_proc_set_acl(inode, buf, buflen); 5974 5970 trace_nfs4_set_acl(inode, err); 5971 + if (err == -NFS4ERR_BADOWNER || err == -NFS4ERR_BADNAME) { 5972 + /* 5973 + * no need to retry since the kernel 5974 + * isn't involved in encoding the ACEs. 5975 + */ 5976 + err = -EINVAL; 5977 + break; 5978 + } 5975 5979 err = nfs4_handle_exception(NFS_SERVER(inode), err, 5976 5980 &exception); 5977 5981 } while (exception.retry); ··· 6421 6409 struct nfs4_exception exception = { 6422 6410 .inode = data->inode, 6423 6411 .stateid = &data->stateid, 6412 + .task_is_privileged = data->args.seq_args.sa_privileged, 6424 6413 }; 6425 6414 6426 6415 if (!nfs4_sequence_done(task, &data->res.seq_res)) ··· 6545 6532 data = kzalloc(sizeof(*data), GFP_NOFS); 6546 6533 if (data == NULL) 6547 6534 return -ENOMEM; 6548 - nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1, 0); 6549 6535 6550 6536 nfs4_state_protect(server->nfs_client, 6551 6537 NFS_SP4_MACH_CRED_CLEANUP, ··· 6575 6563 } 6576 6564 } 6577 6565 6566 + if (!data->inode) 6567 + nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1, 6568 + 1); 6569 + else 6570 + nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1, 6571 + 0); 6578 6572 task_setup_data.callback_data = data; 6579 6573 msg.rpc_argp = &data->args; 6580 6574 msg.rpc_resp = &data->res; ··· 9658 9640 &task_setup_data.rpc_client, &msg); 9659 9641 9660 9642 dprintk("--> %s\n", __func__); 9643 + lrp->inode = nfs_igrab_and_active(lrp->args.inode); 9661 9644 if (!sync) { 9662 - lrp->inode = nfs_igrab_and_active(lrp->args.inode); 9663 9645 if (!lrp->inode) { 9664 9646 nfs4_layoutreturn_release(lrp); 9665 9647 return -EAGAIN; 9666 9648 } 9667 9649 task_setup_data.flags |= RPC_TASK_ASYNC; 9668 9650 } 9669 - nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1, 0); 9651 + if (!lrp->inode) 9652 + nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1, 9653 + 1); 9654 + else 9655 + nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1, 9656 + 0); 9670 9657 task = rpc_run_task(&task_setup_data); 9671 9658 if (IS_ERR(task)) 9672 9659 return PTR_ERR(task);
-4
fs/nfs/nfstrace.h
··· 430 430 { O_NOATIME, "O_NOATIME" }, \ 431 431 { O_CLOEXEC, "O_CLOEXEC" }) 432 432 433 - TRACE_DEFINE_ENUM(FMODE_READ); 434 - TRACE_DEFINE_ENUM(FMODE_WRITE); 435 - TRACE_DEFINE_ENUM(FMODE_EXEC); 436 - 437 433 #define show_fmode_flags(mode) \ 438 434 __print_flags(mode, "|", \ 439 435 { ((__force unsigned long)FMODE_READ), "READ" }, \