Liangyan
307aa80243
ovl: fix dentry leak in ovl_get_redirect
...
commit e04527fefba6e4e66492f122cf8cc6314f3cf3bf upstream.
We need to lock d_parent->d_lock before dget_dlock, or this may
have d_lockref updated parallelly like calltrace below which will
cause dentry->d_lockref leak and risk a crash.
CPU 0 CPU 1
ovl_set_redirect lookup_fast
ovl_get_redirect __d_lookup
dget_dlock
//no lock protection here spin_lock(&dentry->d_lock)
dentry->d_lockref.count++ dentry->d_lockref.count++
[ 49.799059] PGD 800000061fed7067 P4D 800000061fed7067 PUD 61fec5067 PMD 0
[ 49.799689] Oops: 0002 [#1 ] SMP PTI
[ 49.800019] CPU: 2 PID: 2332 Comm: node Not tainted 4.19.24-7.20.al7.x86_64 #1
[ 49.800678] Hardware name: Alibaba Cloud Alibaba Cloud ECS, BIOS 8a46cfe 04/01/2014
[ 49.801380] RIP: 0010:_raw_spin_lock+0xc/0x20
[ 49.803470] RSP: 0018:ffffac6fc5417e98 EFLAGS: 00010246
[ 49.803949] RAX: 0000000000000000 RBX: ffff93b8da3446c0 RCX: 0000000a00000000
[ 49.804600] RDX: 0000000000000001 RSI: 000000000000000a RDI: 0000000000000088
[ 49.805252] RBP: 0000000000000000 R08: 0000000000000000 R09: ffffffff993cf040
[ 49.805898] R10: ffff93b92292e580 R11: ffffd27f188a4b80 R12: 0000000000000000
[ 49.806548] R13: 00000000ffffff9c R14: 00000000fffffffe R15: ffff93b8da3446c0
[ 49.807200] FS: 00007ffbedffb700(0000) GS:ffff93b927880000(0000) knlGS:0000000000000000
[ 49.807935] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 49.808461] CR2: 0000000000000088 CR3: 00000005e3f74006 CR4: 00000000003606a0
[ 49.809113] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 49.809758] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 49.810410] Call Trace:
[ 49.810653] d_delete+0x2c/0xb0
[ 49.810951] vfs_rmdir+0xfd/0x120
[ 49.811264] do_rmdir+0x14f/0x1a0
[ 49.811573] do_syscall_64+0x5b/0x190
[ 49.811917] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 49.812385] RIP: 0033:0x7ffbf505ffd7
[ 49.814404] RSP: 002b:00007ffbedffada8 EFLAGS: 00000297 ORIG_RAX: 0000000000000054
[ 49.815098] RAX: ffffffffffffffda RBX: 00007ffbedffb640 RCX: 00007ffbf505ffd7
[ 49.815744] RDX: 0000000004449700 RSI: 0000000000000000 RDI: 0000000006c8cd50
[ 49.816394] RBP: 00007ffbedffaea0 R08: 0000000000000000 R09: 0000000000017d0b
[ 49.817038] R10: 0000000000000000 R11: 0000000000000297 R12: 0000000000000012
[ 49.817687] R13: 00000000072823d8 R14: 00007ffbedffb700 R15: 00000000072823d8
[ 49.818338] Modules linked in: pvpanic cirrusfb button qemu_fw_cfg atkbd libps2 i8042
[ 49.819052] CR2: 0000000000000088
[ 49.819368] ---[ end trace 4e652b8aa299aa2d ]---
[ 49.819796] RIP: 0010:_raw_spin_lock+0xc/0x20
[ 49.821880] RSP: 0018:ffffac6fc5417e98 EFLAGS: 00010246
[ 49.822363] RAX: 0000000000000000 RBX: ffff93b8da3446c0 RCX: 0000000a00000000
[ 49.823008] RDX: 0000000000000001 RSI: 000000000000000a RDI: 0000000000000088
[ 49.823658] RBP: 0000000000000000 R08: 0000000000000000 R09: ffffffff993cf040
[ 49.825404] R10: ffff93b92292e580 R11: ffffd27f188a4b80 R12: 0000000000000000
[ 49.827147] R13: 00000000ffffff9c R14: 00000000fffffffe R15: ffff93b8da3446c0
[ 49.828890] FS: 00007ffbedffb700(0000) GS:ffff93b927880000(0000) knlGS:0000000000000000
[ 49.830725] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 49.832359] CR2: 0000000000000088 CR3: 00000005e3f74006 CR4: 00000000003606a0
[ 49.834085] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 49.835792] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Cc: <stable@vger.kernel.org>
Fixes: a6c606551141 ("ovl: redirect on rename-dir")
Signed-off-by: Liangyan <liangyan.peng@linux.alibaba.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-10 09:21:07 +01:00
..
2020-11-05 11:08:53 +01:00
2019-08-06 19:06:49 +02:00
2020-09-09 19:04:30 +02:00
2021-02-10 09:21:06 +01:00
2019-12-13 08:51:01 +01:00
2018-12-01 09:37:27 +01:00
2021-01-27 11:05:35 +01:00
2020-11-05 11:08:54 +01:00
2020-12-30 11:26:13 +01:00
2020-12-30 11:26:13 +01:00
2019-08-06 19:06:51 +02:00
2020-05-27 17:37:32 +02:00
2018-11-13 11:08:55 -08:00
2021-01-06 14:44:58 +01:00
2019-05-08 07:21:48 +02:00
2019-03-23 20:09:59 +01:00
2020-10-30 10:38:28 +01:00
2020-02-28 16:38:59 +01:00
2020-12-02 08:48:12 +01:00
2019-12-05 09:20:32 +01:00
2020-01-27 14:50:02 +01:00
2020-09-09 19:04:28 +02:00
2021-01-30 13:32:13 +01:00
2021-01-06 14:44:58 +01:00
2020-06-22 09:05:08 +02:00
2018-12-17 09:24:40 +01:00
2020-11-05 11:08:34 +01:00
2020-12-11 13:25:04 +01:00
2019-12-01 09:17:10 +01:00
2020-04-17 10:48:52 +02:00
2018-08-17 16:20:28 -07:00
2018-08-25 12:42:33 -07:00
2019-05-22 07:37:40 +02:00
2018-08-21 11:37:41 +02:00
2020-09-03 11:24:24 +02:00
2020-12-30 11:26:13 +01:00
2020-12-30 11:26:13 +01:00
2019-12-13 08:52:43 +01:00
2020-12-30 11:25:59 +01:00
2020-08-21 11:05:38 +02:00
2021-02-03 23:23:26 +01:00
2020-12-30 11:26:02 +01:00
2021-01-23 15:49:55 +01:00
2020-06-22 09:05:03 +02:00
2020-06-30 23:17:00 -04:00
2020-10-30 10:38:28 +01:00
2020-11-18 19:18:49 +01:00
2020-02-24 08:34:53 +01:00
2021-02-10 09:21:07 +01:00
2021-01-12 20:10:17 +01:00
2020-08-19 08:15:04 +02:00
2021-01-06 14:45:01 +01:00
2020-10-30 10:38:21 +01:00
2021-01-06 14:45:00 +01:00
2020-08-26 10:30:59 +02:00
2018-08-18 11:44:53 -07:00
2018-12-17 09:24:30 +01:00
2021-01-06 14:44:59 +01:00
2020-11-05 11:08:50 +01:00
2020-08-21 11:05:38 +02:00
2021-01-30 13:32:13 +01:00
2020-06-22 09:05:01 +02:00
2020-06-03 08:19:41 +02:00
2019-07-03 13:14:44 +02:00
2019-11-06 13:05:37 +01:00
2020-10-01 13:14:42 +02:00
2020-11-05 11:08:46 +01:00
2020-01-14 20:06:57 +01:00
2020-01-09 10:19:07 +01:00
2020-05-14 07:57:21 +02:00
2020-03-05 16:42:12 +01:00
2020-11-05 11:08:35 +01:00
2019-03-05 17:58:50 +01:00
2020-01-12 12:17:20 +01:00
2020-02-11 04:34:08 -08:00
2020-10-07 08:00:09 +02:00
2021-01-30 13:32:11 +01:00
2021-01-06 14:45:00 +01:00
2018-08-21 18:19:09 -07:00
2020-05-27 17:37:29 +02:00
2020-04-17 10:48:51 +02:00
2021-01-30 13:32:13 +01:00
2020-03-25 08:06:14 +01:00
2019-05-31 06:46:05 -07:00
2018-11-21 09:19:14 +01:00
2019-12-13 08:52:56 +01:00
2020-11-24 13:27:23 +01:00
2020-01-09 10:19:00 +01:00
2018-08-17 16:20:29 -07:00
2020-03-05 16:42:20 +01:00
2020-04-29 16:31:26 +02:00
2019-05-25 18:23:26 +02:00
2020-03-18 07:14:21 +01:00
2019-05-04 09:20:11 +02:00
2020-05-02 17:26:01 +02:00
2019-12-01 09:17:04 +01:00
2020-01-04 19:13:26 +01:00
2019-08-25 10:47:43 +02:00
2020-08-26 10:31:02 +02:00
2019-12-17 20:35:43 +01:00
2019-10-11 18:21:39 +02:00
2020-11-24 13:27:20 +01:00
2018-08-13 20:56:23 -07:00
2020-01-04 19:13:18 +01:00
2020-08-11 15:32:34 +02:00