• Christoph Hellwig's avatar
    frontswap: don't call ->init if no ops are registered · 37dcc673
    Christoph Hellwig authored
    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 ...
    37dcc673
frontswap.c 7.9 KB