Dan Aloni
fddac3b457
nfsd: under NFSv4.1, fix double svc_xprt_put on rpc_create failure
...
[ Upstream commit 3bc8edc98bd43540dbe648e4ef91f443d6d20a24 ]
On error situation `clp->cl_cb_conn.cb_xprt` should not be given
a reference to the xprt otherwise both client cleanup and the
error handling path of the caller call to put it. Better to
delay handing over the reference to a later branch.
[ 72.530665] refcount_t: underflow; use-after-free.
[ 72.531933] WARNING: CPU: 0 PID: 173 at lib/refcount.c:28 refcount_warn_saturate+0xcf/0x120
[ 72.533075] Modules linked in: nfsd(OE) nfsv4(OE) nfsv3(OE) nfs(OE) lockd(OE) compat_nfs_ssc(OE) nfs_acl(OE) rpcsec_gss_krb5(OE) auth_rpcgss(OE) rpcrdma(OE) dns_resolver fscache netfs grace rdma_cm iw_cm ib_cm sunrpc(OE) mlx5_ib mlx5_core mlxfw pci_hyperv_intf ib_uverbs ib_core xt_MASQUERADE nf_conntrack_netlink nft_counter xt_addrtype nft_compat br_netfilter bridge stp llc nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip_set overlay nf_tables nfnetlink crct10dif_pclmul crc32_pclmul ghash_clmulni_intel xfs serio_raw virtio_net virtio_blk net_failover failover fuse [last unloaded: sunrpc]
[ 72.540389] CPU: 0 PID: 173 Comm: kworker/u16:5 Tainted: G OE 5.15.82-dan #1
[ 72.541511] Hardware name: Red Hat KVM/RHEL-AV, BIOS 1.16.0-3.module+el8.7.0+1084+97b81f61 04/01/2014
[ 72.542717] Workqueue: nfsd4_callbacks nfsd4_run_cb_work [nfsd]
[ 72.543575] RIP: 0010:refcount_warn_saturate+0xcf/0x120
[ 72.544299] Code: 55 00 0f 0b 5d e9 01 50 98 00 80 3d 75 9e 39 08 00 0f 85 74 ff ff ff 48 c7 c7 e8 d1 60 8e c6 05 61 9e 39 08 01 e8 f6 51 55 00 <0f> 0b 5d e9 d9 4f 98 00 80 3d 4b 9e 39 08 00 0f 85 4c ff ff ff 48
[ 72.546666] RSP: 0018:ffffb3f841157cf0 EFLAGS: 00010286
[ 72.547393] RAX: 0000000000000026 RBX: ffff89ac6231d478 RCX: 0000000000000000
[ 72.548324] RDX: ffff89adb7c2c2c0 RSI: ffff89adb7c205c0 RDI: ffff89adb7c205c0
[ 72.549271] RBP: ffffb3f841157cf0 R08: 0000000000000000 R09: c0000000ffefffff
[ 72.550209] R10: 0000000000000001 R11: ffffb3f841157ad0 R12: ffff89ac6231d180
[ 72.551142] R13: ffff89ac6231d478 R14: ffff89ac40c06180 R15: ffff89ac6231d4b0
[ 72.552089] FS: 0000000000000000(0000) GS:ffff89adb7c00000(0000) knlGS:0000000000000000
[ 72.553175] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 72.553934] CR2: 0000563a310506a8 CR3: 0000000109a66000 CR4: 0000000000350ef0
[ 72.554874] Call Trace:
[ 72.555278] <TASK>
[ 72.555614] svc_xprt_put+0xaf/0xe0 [sunrpc]
[ 72.556276] nfsd4_process_cb_update.isra.11+0xb7/0x410 [nfsd]
[ 72.557087] ? update_load_avg+0x82/0x610
[ 72.557652] ? cpuacct_charge+0x60/0x70
[ 72.558212] ? dequeue_entity+0xdb/0x3e0
[ 72.558765] ? queued_spin_unlock+0x9/0x20
[ 72.559358] nfsd4_run_cb_work+0xfc/0x270 [nfsd]
[ 72.560031] process_one_work+0x1df/0x390
[ 72.560600] worker_thread+0x37/0x3b0
[ 72.561644] ? process_one_work+0x390/0x390
[ 72.562247] kthread+0x12f/0x150
[ 72.562710] ? set_kthread_struct+0x50/0x50
[ 72.563309] ret_from_fork+0x22/0x30
[ 72.563818] </TASK>
[ 72.564189] ---[ end trace 031117b1c72ec616 ]---
[ 72.566019] list_add corruption. next->prev should be prev (ffff89ac4977e538), but was ffff89ac4763e018. (next=ffff89ac4763e018).
[ 72.567647] ------------[ cut here ]------------
Fixes: a4abc6b12eb1 ("nfsd: Fix svc_xprt refcnt leak when setup callback client failed")
Cc: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Cc: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Dan Aloni <dan.aloni@vastdata.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-01-18 11:41:31 +01:00
..
2022-06-22 14:11:02 +02:00
2021-03-04 10:26:48 +01:00
2022-12-08 11:23:03 +01:00
2019-10-25 00:03:11 -04:00
2021-01-06 14:48:39 +01:00
2022-12-14 11:30:41 +01:00
2020-11-05 11:43:36 +01:00
2022-12-08 11:23:00 +01:00
2022-11-25 17:42:16 +01:00
2023-01-18 11:41:09 +01:00
2019-11-23 21:44:49 -05:00
2021-09-12 08:56:38 +02:00
2023-01-18 11:40:56 +01:00
2022-02-01 17:24:34 +01:00
2022-10-26 13:22:14 +02:00
2021-05-26 12:05:19 +02:00
2020-12-02 08:49:53 +01:00
2022-08-25 11:17:36 +02:00
2019-11-10 11:56:05 -05:00
2022-08-25 11:17:28 +02:00
2022-11-10 17:57:56 +01:00
2023-01-18 11:41:20 +01:00
2022-06-14 18:11:30 +02:00
2021-09-22 12:26:25 +02:00
2022-12-08 11:23:01 +01:00
2022-11-25 17:42:22 +01:00
2023-01-18 11:40:59 +01:00
2021-05-19 10:08:29 +02:00
2021-04-14 08:24:14 +02:00
2022-05-09 09:03:28 +02:00
2022-06-14 18:11:36 +02:00
2021-11-12 14:43:03 +01:00
2022-10-26 13:22:17 +02:00
2022-06-14 18:11:55 +02:00
2022-06-14 18:11:29 +02:00
2022-11-03 23:56:54 +09:00
2021-09-22 12:26:34 +02:00
2022-04-15 14:18:35 +02:00
2023-01-18 11:41:10 +01:00
2020-12-30 11:51:22 +01:00
2023-01-18 11:41:31 +01:00
2022-12-08 11:23:04 +01:00
2022-06-14 18:11:34 +02:00
2022-11-25 17:42:22 +01:00
2023-01-18 11:40:56 +01:00
2023-01-18 11:41:20 +01:00
2022-08-25 11:17:23 +02:00
2022-10-29 10:20:36 +02:00
2023-01-18 11:40:52 +01:00
2021-09-30 10:09:26 +02:00
2022-10-26 13:22:14 +02:00
2020-10-29 09:57:53 +01:00
2021-08-12 13:21:05 +02:00
2020-08-26 10:40:51 +02:00
2021-05-19 10:08:29 +02:00
2021-03-07 12:20:48 +01:00
2023-01-18 11:40:58 +01:00
2022-09-20 12:28:00 +02:00
2022-04-15 14:18:31 +02:00
2023-01-18 11:40:47 +01:00
2020-08-21 13:05:37 +02:00
2021-10-06 15:42:30 +02:00
2022-11-25 17:42:03 +01:00
2021-12-14 14:49:02 +01:00
2022-08-25 11:17:21 +02:00
2021-10-06 15:42:35 +02:00
2022-06-14 18:11:23 +02:00
2021-03-17 17:03:57 +01:00
2021-05-22 11:38:29 +02:00
2022-11-25 17:42:22 +01:00
2023-01-18 11:41:25 +01:00
2022-06-22 14:11:03 +02:00
2020-12-11 13:23:30 +01:00
2020-10-29 09:57:45 +01:00
2022-06-14 18:11:41 +02:00
2020-10-01 13:17:19 +02:00
2021-04-14 08:24:11 +02:00
2020-01-12 12:21:37 +01:00
2020-02-11 04:35:37 -08:00
2022-12-08 11:23:05 +01:00
2022-06-06 08:33:50 +02:00
2021-09-15 09:47:28 +02:00
2022-05-25 09:14:34 +02:00
2022-03-02 11:41:18 +01:00
2020-04-17 10:50:21 +02:00
2022-02-08 18:24:29 +01:00
2022-06-14 18:11:44 +02:00
2022-10-15 07:54:36 +02:00
2021-07-31 08:19:37 +02:00
2022-10-26 13:22:59 +02:00
2019-12-17 19:55:30 +01:00
2023-01-18 11:40:55 +01:00
2020-03-25 08:25:41 +01:00
2020-01-17 19:48:21 +01:00
2022-11-25 17:42:22 +01:00
2021-08-26 08:36:22 -04:00
2020-03-18 07:17:51 +01:00
2021-08-12 13:21:02 +02:00
2020-05-02 08:48:44 +02:00
2021-03-17 17:03:33 +01:00
2020-02-11 04:35:23 -08:00
2021-04-21 12:56:16 +02:00
2022-01-29 10:25:11 +01:00
2021-07-20 16:10:54 +02:00
2022-09-05 10:27:47 +02:00
2022-10-17 17:24:32 +02:00
2022-04-27 13:50:48 +02:00
2019-10-03 14:21:35 -07:00
2022-02-23 11:59:55 +01:00
2022-10-26 13:22:21 +02:00
2020-02-11 04:35:12 -08:00
2023-01-18 11:40:53 +01:00