mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
da2c8fef13
Grab nfsd_mutex lock in nfsd_nl_rpc_status_get_dumpit routine and remove nfsd_nl_rpc_status_get_start() and nfsd_nl_rpc_status_get_done(). This patch fix the syzbot log reported below: INFO: task syz-executor.1:17770 blocked for more than 143 seconds. Not tainted 6.10.0-rc3-syzkaller-00022-gcea2a26553ac #0 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:syz-executor.1 state:D stack:23800 pid:17770 tgid:17767 ppid:11381 flags:0x00000006 Call Trace: <TASK> context_switch kernel/sched/core.c:5408 [inline] __schedule+0x17e8/0x4a20 kernel/sched/core.c:6745 __schedule_loop kernel/sched/core.c:6822 [inline] schedule+0x14b/0x320 kernel/sched/core.c:6837 schedule_preempt_disabled+0x13/0x30 kernel/sched/core.c:6894 __mutex_lock_common kernel/locking/mutex.c:684 [inline] __mutex_lock+0x6a4/0xd70 kernel/locking/mutex.c:752 nfsd_nl_listener_get_doit+0x115/0x5d0 fs/nfsd/nfsctl.c:2124 genl_family_rcv_msg_doit net/netlink/genetlink.c:1115 [inline] genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline] genl_rcv_msg+0xb16/0xec0 net/netlink/genetlink.c:1210 netlink_rcv_skb+0x1e5/0x430 net/netlink/af_netlink.c:2564 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219 netlink_unicast_kernel net/netlink/af_netlink.c:1335 [inline] netlink_unicast+0x7ec/0x980 net/netlink/af_netlink.c:1361 netlink_sendmsg+0x8db/0xcb0 net/netlink/af_netlink.c:1905 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x223/0x270 net/socket.c:745 ____sys_sendmsg+0x525/0x7d0 net/socket.c:2585 ___sys_sendmsg net/socket.c:2639 [inline] __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2668 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f24ed27cea9 RSP: 002b:00007f24ee0080c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f24ed3b3f80 RCX: 00007f24ed27cea9 RDX: 0000000000000000 RSI: 0000000020000100 RDI: 0000000000000005 RBP: 00007f24ed2ebff4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 Fixes:1bd773b4f0
("nfsd: hold nfsd_mutex across entire netlink operation") Fixes:bd9d6a3efa
("NFSD: add rpc_status netlink support") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
97 lines
2.8 KiB
C
97 lines
2.8 KiB
C
// SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
|
|
/* Do not edit directly, auto-generated from: */
|
|
/* Documentation/netlink/specs/nfsd.yaml */
|
|
/* YNL-GEN kernel source */
|
|
|
|
#include <net/netlink.h>
|
|
#include <net/genetlink.h>
|
|
|
|
#include "netlink.h"
|
|
|
|
#include <uapi/linux/nfsd_netlink.h>
|
|
|
|
/* Common nested types */
|
|
const struct nla_policy nfsd_sock_nl_policy[NFSD_A_SOCK_TRANSPORT_NAME + 1] = {
|
|
[NFSD_A_SOCK_ADDR] = { .type = NLA_BINARY, },
|
|
[NFSD_A_SOCK_TRANSPORT_NAME] = { .type = NLA_NUL_STRING, },
|
|
};
|
|
|
|
const struct nla_policy nfsd_version_nl_policy[NFSD_A_VERSION_ENABLED + 1] = {
|
|
[NFSD_A_VERSION_MAJOR] = { .type = NLA_U32, },
|
|
[NFSD_A_VERSION_MINOR] = { .type = NLA_U32, },
|
|
[NFSD_A_VERSION_ENABLED] = { .type = NLA_FLAG, },
|
|
};
|
|
|
|
/* NFSD_CMD_THREADS_SET - do */
|
|
static const struct nla_policy nfsd_threads_set_nl_policy[NFSD_A_SERVER_SCOPE + 1] = {
|
|
[NFSD_A_SERVER_THREADS] = { .type = NLA_U32, },
|
|
[NFSD_A_SERVER_GRACETIME] = { .type = NLA_U32, },
|
|
[NFSD_A_SERVER_LEASETIME] = { .type = NLA_U32, },
|
|
[NFSD_A_SERVER_SCOPE] = { .type = NLA_NUL_STRING, },
|
|
};
|
|
|
|
/* NFSD_CMD_VERSION_SET - do */
|
|
static const struct nla_policy nfsd_version_set_nl_policy[NFSD_A_SERVER_PROTO_VERSION + 1] = {
|
|
[NFSD_A_SERVER_PROTO_VERSION] = NLA_POLICY_NESTED(nfsd_version_nl_policy),
|
|
};
|
|
|
|
/* NFSD_CMD_LISTENER_SET - do */
|
|
static const struct nla_policy nfsd_listener_set_nl_policy[NFSD_A_SERVER_SOCK_ADDR + 1] = {
|
|
[NFSD_A_SERVER_SOCK_ADDR] = NLA_POLICY_NESTED(nfsd_sock_nl_policy),
|
|
};
|
|
|
|
/* Ops table for nfsd */
|
|
static const struct genl_split_ops nfsd_nl_ops[] = {
|
|
{
|
|
.cmd = NFSD_CMD_RPC_STATUS_GET,
|
|
.dumpit = nfsd_nl_rpc_status_get_dumpit,
|
|
.flags = GENL_CMD_CAP_DUMP,
|
|
},
|
|
{
|
|
.cmd = NFSD_CMD_THREADS_SET,
|
|
.doit = nfsd_nl_threads_set_doit,
|
|
.policy = nfsd_threads_set_nl_policy,
|
|
.maxattr = NFSD_A_SERVER_SCOPE,
|
|
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
|
|
},
|
|
{
|
|
.cmd = NFSD_CMD_THREADS_GET,
|
|
.doit = nfsd_nl_threads_get_doit,
|
|
.flags = GENL_CMD_CAP_DO,
|
|
},
|
|
{
|
|
.cmd = NFSD_CMD_VERSION_SET,
|
|
.doit = nfsd_nl_version_set_doit,
|
|
.policy = nfsd_version_set_nl_policy,
|
|
.maxattr = NFSD_A_SERVER_PROTO_VERSION,
|
|
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
|
|
},
|
|
{
|
|
.cmd = NFSD_CMD_VERSION_GET,
|
|
.doit = nfsd_nl_version_get_doit,
|
|
.flags = GENL_CMD_CAP_DO,
|
|
},
|
|
{
|
|
.cmd = NFSD_CMD_LISTENER_SET,
|
|
.doit = nfsd_nl_listener_set_doit,
|
|
.policy = nfsd_listener_set_nl_policy,
|
|
.maxattr = NFSD_A_SERVER_SOCK_ADDR,
|
|
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
|
|
},
|
|
{
|
|
.cmd = NFSD_CMD_LISTENER_GET,
|
|
.doit = nfsd_nl_listener_get_doit,
|
|
.flags = GENL_CMD_CAP_DO,
|
|
},
|
|
};
|
|
|
|
struct genl_family nfsd_nl_family __ro_after_init = {
|
|
.name = NFSD_FAMILY_NAME,
|
|
.version = NFSD_FAMILY_VERSION,
|
|
.netnsok = true,
|
|
.parallel_ops = true,
|
|
.module = THIS_MODULE,
|
|
.split_ops = nfsd_nl_ops,
|
|
.n_split_ops = ARRAY_SIZE(nfsd_nl_ops),
|
|
};
|