Christoph Hellwig
37dcc673d0
frontswap: don't call ->init if no ops are registered
...
If no frontswap module (i.e. zswap) was registered, frontswap_ops will be
NULL. In such situation, swapon crashes with the following stack trace:
Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000000
Mem abort info:
ESR = 0x0000000096000004
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x04: level 0 translation fault
Data abort info:
ISV = 0, ISS = 0x00000004
CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=00000020a4fab000
[0000000000000000] pgd=0000000000000000, p4d=0000000000000000
Internal error: Oops: 96000004 [#1 ] SMP
Modules linked in: zram fsl_dpaa2_eth pcs_lynx phylink ahci_qoriq crct10dif_ce ghash_ce sbsa_gwdt fsl_mc_dpio nvme lm90 nvme_core at803x xhci_plat_hcd rtc_fsl_ftm_alarm xgmac_mdio ahci_platform i2c_imx ip6_tables ip_tables fuse
Unloaded tainted modules: cppc_cpufreq():1
CPU: 10 PID: 761 Comm: swapon Not tainted 6.0.0-rc2-00454-g22100432cf14 #1
Hardware name: SolidRun Ltd. SolidRun CEX7 Platform, BIOS EDK II Jun 21 2022
pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : frontswap_init+0x38/0x60
lr : __do_sys_swapon+0x8a8/0x9f4
sp : ffff80000969bcf0
x29: ffff80000969bcf0 x28: ffff37bee0d8fc00 x27: ffff80000a7f5000
x26: fffffcdefb971e80 x25: ffffaba797453b90 x24: 0000000000000064
x23: ffff37c1f209d1a8 x22: ffff37bee880e000 x21: ffffaba797748560
x20: ffff37bee0d8fce4 x19: ffffaba797748488 x18: 0000000000000014
x17: 0000000030ec029a x16: ffffaba795a479b0 x15: 0000000000000000
x14: 0000000000000000 x13: 0000000000000030 x12: 0000000000000001
x11: ffff37c63c0aba18 x10: 0000000000000000 x9 : ffffaba7956b8c88
x8 : ffff80000969bcd0 x7 : 0000000000000000 x6 : 0000000000000000
x5 : 0000000000000001 x4 : 0000000000000000 x3 : ffffaba79730f000
x2 : ffff37bee0d8fc00 x1 : 0000000000000000 x0 : 0000000000000000
Call trace:
frontswap_init+0x38/0x60
__do_sys_swapon+0x8a8/0x9f4
__arm64_sys_swapon+0x28/0x3c
invoke_syscall+0x78/0x100
el0_svc_common.constprop.0+0xd4/0xf4
do_el0_svc+0x38/0x4c
el0_svc+0x34/0x10c
el0t_64_sync_handler+0x11c/0x150
el0t_64_sync+0x190/0x194
Code: d000e283 910003fd f9006c41 f946d461 (f9400021)
---[ end trace 0000000000000000 ]---
Link: https://lkml.kernel.org/r/20220909130829.3262926-1-hch@lst.de
Fixes: 1da0d94a3ec8 ("frontswap: remove support for multiple ops")
Reported-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2022-09-26 12:14:34 -07:00
..
2022-09-11 16:22:31 -07:00
2022-08-05 16:32:45 -07:00
2022-08-05 16:32:45 -07:00
2022-08-28 14:02:43 -07:00
2022-08-02 12:34:03 -04:00
2022-08-28 14:02:45 -07:00
2022-07-29 18:07:16 -07:00
2022-05-13 15:11:26 -07:00
2022-03-22 15:57:09 -07:00
2022-08-05 16:32:45 -07:00
2022-06-27 12:52:53 -07:00
2022-03-24 19:06:45 -07:00
2022-01-15 16:30:28 +02:00
2022-03-22 15:57:11 -07:00
2022-04-26 13:36:25 -07:00
2022-05-19 14:08:55 -07:00
2022-08-05 16:32:45 -07:00
2022-08-02 12:34:04 -04:00
2022-09-26 12:14:34 -07:00
2022-07-17 17:14:27 -07:00
2022-09-26 12:14:33 -07:00
2022-08-05 16:32:45 -07:00
2022-07-29 11:33:37 -07:00
2022-09-26 12:14:33 -07:00
2022-07-29 18:07:17 -07:00
2022-08-08 18:06:43 -07:00
2022-08-08 18:06:43 -07:00
2022-08-28 14:02:43 -07:00
2022-06-16 19:11:32 -07:00
2022-02-14 19:51:47 +01:00
2022-08-05 16:32:45 -07:00
2022-06-27 12:22:31 +01:00
2022-08-10 11:07:26 -07:00
2022-05-27 11:40:49 -07:00
2022-09-26 12:14:33 -07:00
2022-06-16 19:48:32 -07:00
2022-08-05 16:32:45 -07:00
2022-06-16 19:48:31 -07:00
2022-03-23 18:03:08 -07:00
2022-09-26 12:14:33 -07:00
2022-07-03 18:08:40 -07:00
2022-01-15 16:30:27 +02:00
2022-08-09 09:48:30 -07:00
2022-07-29 18:07:18 -07:00
2022-03-05 11:08:32 -08:00
2022-07-29 18:07:20 -07:00
2022-09-11 16:22:30 -07:00
2022-08-05 16:32:45 -07:00
2022-07-29 18:07:16 -07:00
2022-06-16 19:48:30 -07:00
2022-08-05 16:32:45 -07:00
2022-09-11 16:22:30 -07:00
2022-08-05 16:32:45 -07:00
2022-05-13 07:20:09 -07:00
2022-07-17 17:14:28 -07:00
2021-07-23 17:43:28 -07:00
2022-08-20 15:17:45 -07:00
2022-04-28 23:16:12 -07:00
2022-04-21 20:01:10 -07:00
2022-03-22 17:03:12 -07:00
2022-08-28 14:02:46 -07:00
2022-05-26 12:32:41 -07:00
2022-07-17 17:14:37 -07:00
2022-06-01 15:57:16 -07:00
2022-09-11 16:22:29 -07:00
2022-01-15 16:30:27 +02:00
2022-04-29 14:36:58 -07:00
2022-05-19 14:08:54 -07:00
2022-05-26 12:32:41 -07:00
2022-06-16 19:11:30 -07:00
2022-05-26 12:32:41 -07:00
2021-06-29 10:53:47 -07:00
2021-06-29 10:53:47 -07:00
2022-05-27 11:29:35 -07:00
2022-07-17 17:14:47 -07:00
2022-08-28 14:02:43 -07:00
2021-06-29 10:53:49 -07:00
2022-05-13 07:20:18 -07:00
2021-07-04 18:30:17 +00:00
2022-03-08 09:30:46 -05:00
2021-07-04 18:30:17 +00:00
2022-07-17 17:14:47 -07:00
2022-05-13 07:20:05 -07:00
2022-03-22 15:57:08 -07:00
2022-06-23 12:22:00 -04:00
2022-08-05 16:32:45 -07:00
2022-09-11 16:22:31 -07:00
2022-08-28 14:02:43 -07:00
2022-07-29 18:07:13 -07:00
2021-05-22 15:09:07 -10:00
2022-07-20 13:30:12 +02:00
2022-08-05 16:32:45 -07:00
2022-07-20 13:30:12 +02:00
2022-07-20 13:30:12 +02:00
2022-07-20 13:30:11 +02:00
2022-08-08 18:06:42 -07:00
2022-07-03 18:08:49 -07:00
2022-03-08 09:30:46 -05:00
2022-07-20 10:52:40 +01:00
2022-09-11 16:22:31 -07:00
2022-08-05 16:32:45 -07:00
2022-07-03 18:08:52 -07:00
2022-07-03 18:08:48 -07:00
2022-06-29 08:51:05 -04:00
2022-07-01 17:03:38 -07:00
2022-08-20 15:17:45 -07:00
2022-08-05 16:32:45 -07:00
2022-07-03 18:08:41 -07:00
2021-11-06 13:30:40 -07:00
2022-09-11 16:22:31 -07:00
2022-08-20 15:17:45 -07:00
2022-07-03 18:08:40 -07:00
2022-08-02 12:34:03 -04:00
2021-07-01 11:06:03 -07:00
2022-01-15 16:30:31 +02:00
2022-08-28 14:02:44 -07:00
2022-05-19 14:08:53 -07:00