1. 05 Aug, 2022 6 commits
    • Daeho Jeong's avatar
      f2fs: handle decompress only post processing in softirq · bff139b4
      Daeho Jeong authored
      Now decompression is being handled in workqueue and it makes read I/O
      latency non-deterministic, because of the non-deterministic scheduling
      nature of workqueues. So, I made it handled in softirq context only if
      possible, not in low memory devices, since this modification will
      maintain decompresion related memory a little longer.
      Signed-off-by: default avatarDaeho Jeong <daehojeong@google.com>
      Reviewed-by: default avatarChao Yu <chao@kernel.org>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      bff139b4
    • Jaewook Kim's avatar
      f2fs: do not allow to decompress files have FI_COMPRESS_RELEASED · 90be48bd
      Jaewook Kim authored
      If a file has FI_COMPRESS_RELEASED, all writes for it should not be
      allowed. However, as of now, in case of compress_mode=user, writes
      triggered by IOCTLs like F2FS_IOC_DE/COMPRESS_FILE are allowed unexpectly,
      which could crash that file.
      To fix it, let's do not allow F2FS_IOC_DE/COMPRESS_IOCTL if a file already
      has FI_COMPRESS_RELEASED flag.
      
      This is the reproduction process:
      1.  $ touch ./file
      2.  $ chattr +c ./file
      3.  $ dd if=/dev/random of=./file bs=4096 count=30 conv=notrunc
      4.  $ dd if=/dev/zero of=./file bs=4096 count=34 seek=30 conv=notrunc
      5.  $ sync
      6.  $ do_compress ./file      ; call F2FS_IOC_COMPRESS_FILE
      7.  $ get_compr_blocks ./file ; call F2FS_IOC_GET_COMPRESS_BLOCKS
      8.  $ release ./file          ; call F2FS_IOC_RELEASE_COMPRESS_BLOCKS
      9.  $ do_compress ./file      ; call F2FS_IOC_COMPRESS_FILE again
      10. $ get_compr_blocks ./file ; call F2FS_IOC_GET_COMPRESS_BLOCKS again
      
      This reproduction process is tested in 128kb cluster size.
      You can find compr_blocks has a negative value.
      
      Fixes: 5fdb322f ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE")
      Signed-off-by: default avatarJunbeom Yeom <junbeom.yeom@samsung.com>
      Signed-off-by: default avatarSungjong Seo <sj1557.seo@samsung.com>
      Signed-off-by: default avatarYoungjin Gil <youngjin.gil@samsung.com>
      Signed-off-by: default avatarJaewook Kim <jw5454.kim@samsung.com>
      Reviewed-by: default avatarChao Yu <chao@kernel.org>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      90be48bd
    • Jaegeuk Kim's avatar
      f2fs: do not set compression bit if kernel doesn't support · 912f0d65
      Jaegeuk Kim authored
      If kernel doesn't have CONFIG_F2FS_FS_COMPRESSION, a file having FS_COMPR_FL via
      ioctl(FS_IOC_SETFLAGS) is unaccessible due to f2fs_is_compress_backend_ready().
      Let's avoid it.
      Reviewed-by: default avatarChao Yu <chao@kernel.org>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      912f0d65
    • Eunhee Rho's avatar
      f2fs: remove device type check for direct IO · dbf8e63f
      Eunhee Rho authored
      To ensure serialized IOs, f2fs allows only LFS mode for zoned
      device. Remove redundant check for direct IO.
      Signed-off-by: default avatarEunhee Rho <eunhee83.rho@samsung.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      dbf8e63f
    • Ye Bin's avatar
      f2fs: fix null-ptr-deref in f2fs_get_dnode_of_data · 4a2c5b79
      Ye Bin authored
      There is issue as follows when test f2fs atomic write:
      F2FS-fs (loop0): Can't find valid F2FS filesystem in 2th superblock
      F2FS-fs (loop0): invalid crc_offset: 0
      F2FS-fs (loop0): f2fs_check_nid_range: out-of-range nid=1, run fsck to fix.
      F2FS-fs (loop0): f2fs_check_nid_range: out-of-range nid=2, run fsck to fix.
      ==================================================================
      BUG: KASAN: null-ptr-deref in f2fs_get_dnode_of_data+0xac/0x16d0
      Read of size 8 at addr 0000000000000028 by task rep/1990
      
      CPU: 4 PID: 1990 Comm: rep Not tainted 5.19.0-rc6-next-20220715 #266
      Call Trace:
       <TASK>
       dump_stack_lvl+0x6e/0x91
       print_report.cold+0x49a/0x6bb
       kasan_report+0xa8/0x130
       f2fs_get_dnode_of_data+0xac/0x16d0
       f2fs_do_write_data_page+0x2a5/0x1030
       move_data_page+0x3c5/0xdf0
       do_garbage_collect+0x2015/0x36c0
       f2fs_gc+0x554/0x1d30
       f2fs_balance_fs+0x7f5/0xda0
       f2fs_write_single_data_page+0xb66/0xdc0
       f2fs_write_cache_pages+0x716/0x1420
       f2fs_write_data_pages+0x84f/0x9a0
       do_writepages+0x130/0x3a0
       filemap_fdatawrite_wbc+0x87/0xa0
       file_write_and_wait_range+0x157/0x1c0
       f2fs_do_sync_file+0x206/0x12d0
       f2fs_sync_file+0x99/0xc0
       vfs_fsync_range+0x75/0x140
       f2fs_file_write_iter+0xd7b/0x1850
       vfs_write+0x645/0x780
       ksys_write+0xf1/0x1e0
       do_syscall_64+0x3b/0x90
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      As 3db1de0e commit changed atomic write way which new a cow_inode for
      atomic write file, and also mark cow_inode as FI_ATOMIC_FILE.
      When f2fs_do_write_data_page write cow_inode will use cow_inode's cow_inode
      which is NULL. Then will trigger null-ptr-deref.
      To solve above issue, introduce FI_COW_FILE flag for COW inode.
      
      Fiexes: 3db1de0e("f2fs: change the current atomic write way")
      Signed-off-by: default avatarYe Bin <yebin10@huawei.com>
      Reviewed-by: default avatarChao Yu <chao@kernel.org>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      4a2c5b79
    • Daeho Jeong's avatar
      f2fs: revive F2FS_IOC_ABORT_VOLATILE_WRITE · 23339e57
      Daeho Jeong authored
      F2FS_IOC_ABORT_VOLATILE_WRITE was used to abort a atomic write before.
      However it was removed accidentally. So revive it by changing the name,
      since volatile write had gone.
      Signed-off-by: default avatarDaeho Jeong <daehojeong@google.com>
      Fiexes: 7bc155fe("f2fs: kill volatile write support")
      Reviewed-by: default avatarChao Yu <chao@kernel.org>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      23339e57
  2. 31 Jul, 2022 16 commits
  3. 28 Jun, 2022 3 commits
  4. 25 Jun, 2022 12 commits
    • Eric Biggers's avatar
      f2fs: use the updated test_dummy_encryption helper functions · c5bca38d
      Eric Biggers authored
      Switch f2fs over to the functions that are replacing
      fscrypt_set_test_dummy_encryption().  Since f2fs hasn't been converted
      to the new mount API yet, this doesn't really provide a benefit for
      f2fs.  But it allows fscrypt_set_test_dummy_encryption() to be removed.
      
      Also take the opportunity to eliminate an #ifdef.
      Reviewed-by: default avatarChao Yu <chao@kernel.org>
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      c5bca38d
    • Linus Torvalds's avatar
      Merge tag 'char-misc-5.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 0840a791
      Linus Torvalds authored
      Pull IIO driver fixes from Greg KH:
       "Here are a set of IIO driver fixes for 5.19-rc4. Jonathan said it best
        in his pull request to me, so I'll just quote it here below, as that's
        the only changes we have right now for the char-misc driver tree:
      
        testing:
            - Fix a missing MODULE_LICENSE() warning by restricting possible
              build configs.
      
        Various drivers:
            - Fix ordering of iio_get_trigger() being called before
              iio_trigger_register()
      
        adi,admv1014:
            - Fix dubious x & !y warning.
      
        adi,axi-adc:
            - Fix missing of_node_put() in error and normal paths.
      
        aspeed,adc:
            - Add missing of_node_put()
      
        fsl,mma8452:
            - Fix broken probing from device tree.
            - Drop check on return value of i2c write to device to cause reset
              as ACK will be missing (device reset before sending it).
      
        fsl,vf610:
            - Fix documentation of in_conversion_mode ABI.
      
        iio-trig-sysfs:
            - Ensure irq work has finished before freeing the trigger.
      
        invensense,mpu3050:
            - Disable regulators in error path.
      
        invensense,icm42600:
            - Fix collision of enum value of 0 with error path where 0 is no
              match.
      
        renesas,rzg2l_Adc:
            - Add missing fwnode_handle_put() in error path.
      
        rescale:
            - Fix a boolean logic bug for detection of raw + scale affecting
              an obscure corner case.
      
        semtech,sx9324:
            - Check return value of read of pin_defs
      
        st,stm32-adc:
            - Fix interaction across ADC instances for some supported devices.
            - Drop false spurious IRQ messages.
            - Fix calibration value handling. If we can't calibrate don't
              expose the vref_int channel.
            - Fix maximum clock rate for stm32pm15x
      
        ti,ads131e08:
            - Add missing fwnode_handle_put() in error paths.
      
        xilinx,ams:
            - Fix variable checked for error from platform_get_irq()
      
        x-powers,axp288:
            - Overide TS_PIN bias current for boards where it is not correctly
              initialized.
      
        yamaha,yas530:
            - Fix inverted check on calibration data being all zeros.
      
        All of these have been in linux-next for a while with no reported
        problems"
      
      * tag 'char-misc-5.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (26 commits)
        iio:proximity:sx9324: Check ret value of device_property_read_u32_array()
        iio: accel: mma8452: ignore the return value of reset operation
        iio: adc: stm32: fix maximum clock rate for stm32mp15x
        iio: adc: stm32: fix vrefint wrong calibration value handling
        iio: imu: inv_icm42600: Fix broken icm42600 (chip id 0 value)
        iio: adc: vf610: fix conversion mode sysfs node name
        iio: adc: adi-axi-adc: Fix refcount leak in adi_axi_adc_attach_client
        iio: test: fix missing MODULE_LICENSE for IIO_RESCALE=m
        iio:humidity:hts221: rearrange iio trigger get and register
        iio:chemical:ccs811: rearrange iio trigger get and register
        iio:accel:mxc4005: rearrange iio trigger get and register
        iio:accel:kxcjk-1013: rearrange iio trigger get and register
        iio:accel:bma180: rearrange iio trigger get and register
        iio: afe: rescale: Fix boolean logic bug
        iio: adc: aspeed: Fix refcount leak in aspeed_adc_set_trim_data
        iio: adc: stm32: Fix IRQs on STM32F4 by removing custom spurious IRQs message
        iio: adc: stm32: Fix ADCs iteration in irq handler
        iio: adc: ti-ads131e08: add missing fwnode_handle_put() in ads131e08_alloc_channels()
        iio: adc: rzg2l_adc: add missing fwnode_handle_put() in rzg2l_adc_parse_properties()
        iio: trigger: sysfs: fix use-after-free on remove
        ...
      0840a791
    • Linus Torvalds's avatar
      Merge tag 'usb-5.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · c24eb8d6
      Linus Torvalds authored
      Pull USB driver fixes from Greg KH:
       "Here are some small USB driver fixes and new device ids for 5.19-rc4
        for a few small reported issues. They include:
      
         - new usb-serial driver ids
      
         - MAINTAINERS file update to properly catch the USB dts files
      
         - dt-bindings fixes for reported build warnings
      
         - xhci driver fixes for reported problems
      
         - typec Kconfig dependancy fix
      
         - raw_gadget fuzzing fixes found by syzbot
      
         - chipidea driver bugfix
      
         - usb gadget uvc bugfix
      
        All of these have been in linux-next with no reported issues"
      
      * tag 'usb-5.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        usb: chipidea: udc: check request status before setting device address
        USB: gadget: Fix double-free bug in raw_gadget driver
        xhci-pci: Allow host runtime PM as default for Intel Meteor Lake xHCI
        xhci-pci: Allow host runtime PM as default for Intel Raptor Lake xHCI
        xhci: turn off port power in shutdown
        xhci: Keep interrupt disabled in initialization until host is running.
        USB: serial: option: add Quectel RM500K module support
        USB: serial: option: add Quectel EM05-G modem
        USB: serial: pl2303: add support for more HXN (G) types
        usb: typec: wcove: Drop wrong dependency to INTEL_SOC_PMIC
        usb: gadget: uvc: fix list double add in uvcg_video_pump
        dt-bindings: usb: ehci: Increase the number of PHYs
        dt-bindings: usb: ohci: Increase the number of PHYs
        usb: gadget: Fix non-unique driver names in raw-gadget driver
        MAINTAINERS: add include/dt-bindings/usb to USB SUBSYSTEM
        USB: serial: option: add Telit LE910Cx 0x1250 composition
      c24eb8d6
    • Linus Torvalds's avatar
      Merge tag 'loongarch-fixes-5.19-3' of... · cb84318b
      Linus Torvalds authored
      Merge tag 'loongarch-fixes-5.19-3' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
      
      Pull LoongArch fixes from Huacai Chen:
       "Some bug fixes and a trivial cleanup"
      
      * tag 'loongarch-fixes-5.19-3' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson:
        LoongArch: Make compute_return_era() return void
        LoongArch: Fix wrong fpu version
        LoongArch: Fix EENTRY/MERRENTRY setting in setup_tlb_handler()
        LoongArch: Fix sleeping in atomic context in setup_tlb_handler()
        LoongArch: Fix the _stext symbol address
        LoongArch: Fix the !THP build
      cb84318b
    • Linus Torvalds's avatar
      Merge tag 'f2fs-for-5.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs · 29eeafc6
      Linus Torvalds authored
      Pull f2fs fixes from Jaegeuk Kim:
       "Some urgent fixes to avoid generating corrupted inodes caused by
        compressed and inline_data files.
      
        In addition, avoid a wrong error report which prevents a roll-forward
        recovery"
      
      * tag 'f2fs-for-5.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs:
        f2fs: do not count ENOENT for error case
        f2fs: fix iostat related lock protection
        f2fs: attach inline_data after setting compression
      29eeafc6
    • Tiezhu Yang's avatar
      LoongArch: Make compute_return_era() return void · ea18d434
      Tiezhu Yang authored
      compute_return_era() always returns 0, make it return void,
      and then no need to check its return value for its callers.
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      ea18d434
    • Tiezhu Yang's avatar
      LoongArch: Fix wrong fpu version · ad82eef3
      Tiezhu Yang authored
      According to the configuration information accessible by the CPUCFG
      instruction in LoongArch Reference Manual [1], FP_ver is stored in
      bit [5: 3] of CPUCFG2, the current code to get fpu version is wrong,
      use CPUCFG2_FPVERS to fix it.
      
      [1] https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html
      
      Fixes: 628c3bb4 ("LoongArch: Add boot and setup routines")
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      ad82eef3
    • Huacai Chen's avatar
      LoongArch: Fix EENTRY/MERRENTRY setting in setup_tlb_handler() · 26808ceb
      Huacai Chen authored
      setup_tlb_handler() is expected to set per-cpu exception handlers, but
      it only set the TLBRENTRY successfully because of copy & paste errors,
      so fix it.
      Reviewed-by: default avatarWANG Xuerui <git@xen0n.name>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      26808ceb
    • Huacai Chen's avatar
      LoongArch: Fix sleeping in atomic context in setup_tlb_handler() · bab1c299
      Huacai Chen authored
      Since setup_tlb_handler() is executed in atomic context, we should use
      GFP_ATOMIC instead of GFP_KERNEL to alloc pages. Otherwise we will get
      a "sleeping in atomic context" error:
      
      [    0.013118] BUG: sleeping function called from invalid context at mm/page_alloc.c:5158
      [    0.013126] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 0, name: swapper/1
      [    0.013131] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.19-rc3+ #1008 1a223086d14d07967cc427f15d52139422271360
      [    0.013136] Hardware name: Loongson Loongson-3A5000-7A1000-1w-V0.1-CRB/Loongson-LS3A5000-7A1000-1w-EVB-V1.21, BIOS Loongson-UDK2018-V2.0.04082-beta7 04/27
      [    0.013140] Stack : 90000000015fc990 9000000100493c18 9000000000df3370 9000000100490000
      [    0.013151]         9000000100493b50 0000000000000000 9000000100493b58 9000000001417ef0
      [    0.013160]         900000000199e54e 0000000000000040 9000000100493c18 90000000015f7a98
      [    0.013168]         ffffffffffffffff 6de72f8b42179d1e 9000000100403b80 90000000015f7890
      [    0.013176]         0000000000000001 00000000fffff175 9000000000eb9860 9000000001530b4b
      [    0.013184]         9000000000e99e60 0000000000000013 0000000006ecc000 0000000000000001
      [    0.013193]         90000000015f7a98 9000000001417ef0 0000000000000004 0000000000000000
      [    0.013201]         0000000000000cc0 0000000000000000 0000000000000001 90000000015fc990
      [    0.013209]         9000000000217e74 9000000001603b6b 9000000000208640 0000000000000000
      [    0.013217]         00000000000000b0 0000000000000004 0000000000000000 0000000000070000
      [    0.013225]         ...
      [    0.013229] Call Trace:
      [    0.013230] [<9000000000208640>] show_stack+0x4c/0x14c
      [    0.013240] [<9000000000df3370>] dump_stack_lvl+0x70/0xac
      [    0.013246] [<9000000000270c8c>] ___might_sleep+0x104/0x124
      [    0.013253] [<9000000000477e84>] __alloc_pages+0x240/0x464
      [    0.013260] [<9000000000214214>] setup_tlb_handler+0x104/0x1e8
      [    0.013265] [<9000000000214324>] tlb_init+0x2c/0x3c
      [    0.013270] [<9000000000208b74>] per_cpu_trap_init+0xec/0x108
      [    0.013275] [<9000000000202850>] cpu_probe+0x400/0x8a4
      [    0.013279] [<900000000020d160>] start_secondary+0x5c/0x3d4
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      bab1c299
    • Huacai Chen's avatar
      LoongArch: Fix the _stext symbol address · 92264f2d
      Huacai Chen authored
      _stext means the start of .text section (see __is_kernel_text()), but we
      put its definition in .ref.text by mistake. Fix it by defining it in the
      vmlinux.lds.S.
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      92264f2d
    • Huacai Chen's avatar
      LoongArch: Fix the !THP build · 501dcbe4
      Huacai Chen authored
      Fix the !THP build by making pmd_pfn() available in all configurations.
      Because pmd_pfn() is used in mm/page_vma_mapped.c whether or not THP is
      configured.
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      501dcbe4
    • Linus Torvalds's avatar
      Merge tag 'gpio-fixes-for-v5.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux · 8c23f235
      Linus Torvalds authored
      Pull gpio fixes from Bartosz Golaszewski:
      
       - make the irqchip immutable in gpio-realtek-otto
      
       - fix error code propagation in gpio-winbond
      
       - fix device removing in gpio-grgpio
      
       - fix a typo in gpio-mxs which indicates the driver is for a different
         model
      
       - documentation fixes
      
       - MAINTAINERS file updates
      
      * tag 'gpio-fixes-for-v5.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
        gpio: mxs: Fix header comment
        gpio: Fix kernel-doc comments to nested union
        gpio: grgpio: Fix device removing
        gpio: winbond: Fix error code in winbond_gpio_get()
        gpio: realtek-otto: Make the irqchip immutable
        docs: driver-api: gpio: Fix filename mismatch
        MAINTAINERS: add include/dt-bindings/gpio to GPIO SUBSYSTEM
      8c23f235
  5. 24 Jun, 2022 3 commits