1. 31 7月, 2021 13 次提交
  2. 30 7月, 2021 9 次提交
  3. 29 7月, 2021 14 次提交
    • D
      btrfs: calculate number of eb pages properly in csum_tree_block · 7280305e
      David Sterba 提交于
      Building with -Warray-bounds on systems with 64K pages there's a
      warning:
      
        fs/btrfs/disk-io.c: In function ‘csum_tree_block’:
        fs/btrfs/disk-io.c:226:34: warning: array subscript 1 is above array bounds of ‘struct page *[1]’ [-Warray-bounds]
          226 |   kaddr = page_address(buf->pages[i]);
              |                        ~~~~~~~~~~^~~
        ./include/linux/mm.h:1630:48: note: in definition of macro ‘page_address’
         1630 | #define page_address(page) lowmem_page_address(page)
              |                                                ^~~~
        In file included from fs/btrfs/ctree.h:32,
                         from fs/btrfs/disk-io.c:23:
        fs/btrfs/extent_io.h:98:15: note: while referencing ‘pages’
           98 |  struct page *pages[1];
              |               ^~~~~
      
      The compiler has no way to know that in that case the nodesize is exactly
      PAGE_SIZE, so the resulting number of pages will be correct (1).
      
      Let's use num_extent_pages that makes the case nodesize == PAGE_SIZE
      explicitly 1.
      Reported-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
      Reviewed-by: NQu Wenruo <wqu@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      7280305e
    • M
      HID: ft260: fix device removal due to USB disconnect · db8d3a21
      Michael Zaidman 提交于
      This commit fixes a functional regression introduced by the commit 82f09a63
      ("HID: ft260: improve error handling of ft260_hid_feature_report_get()")
      when upon USB disconnect, the FTDI FT260 i2c device is still available within
      the /dev folder.
      
      In my company's product, where the host USB to FT260 USB connection is
      hard-wired in the PCB, the issue is not reproducible. To reproduce it, I used
      the VirtualBox Ubuntu 20.04 VM and the UMFT260EV1A development module for the
      FTDI FT260 chip:
      
      Plug the UMFT260EV1A module into a USB port and attach it to VM.
      
      The VM shows 2 i2c devices under the /dev:
          michael@michael-VirtualBox:~$ ls /dev/i2c-*
          /dev/i2c-0  /dev/i2c-1
      
      The i2c-0 is not related to the FTDI FT260:
          michael@michael-VirtualBox:~$ cat /sys/bus/i2c/devices/i2c-0/name
          SMBus PIIX4 adapter at 4100
      
      The i2c-1 is created by hid-ft260.ko:
          michael@michael-VirtualBox:~$ cat /sys/bus/i2c/devices/i2c-1/name
          FT260 usb-i2c bridge on hidraw1
      
      Now, detach the FTDI FT260 USB device from VM. We expect the /dev/i2c-1
      to disappear, but it's still here:
          michael@michael-VirtualBox:~$ ls /dev/i2c-*
          /dev/i2c-0  /dev/i2c-1
      
      And the kernel log shows:
          [  +0.001202] usb 2-2: USB disconnect, device number 3
          [  +0.000109] ft260 0003:0403:6030.0002: failed to retrieve system status
          [  +0.000316] ft260 0003:0403:6030.0003: failed to retrieve system status
      
      It happens because the commit 82f09a63 changed the ft260_get_system_config()
      return logic. This caused the ft260_is_interface_enabled() to exit with error
      upon the FT260 device USB disconnect, which in turn, aborted the ft260_remove()
      before deleting the FT260 i2c device and cleaning its sysfs stuff.
      
      This commit restores the FT260 USB removal functionality and improves the
      ft260_is_interface_enabled() code to handle correctly all chip modes defined
      by the device interface configuration pins DCNF0 and DCNF1.
      Signed-off-by: NMichael Zaidman <michael.zaidman@gmail.com>
      Acked-by: NAaron Jones (FTDI-UK) <aaron.jones@ftdichip.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      db8d3a21
    • D
      Merge tag 'amd-drm-fixes-5.14-2021-07-28' of... · d28e2568
      Dave Airlie 提交于
      Merge tag 'amd-drm-fixes-5.14-2021-07-28' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
      
      amd-drm-fixes-5.14-2021-07-28:
      
      amdgpu:
      - Fix resource leak in an error path
      - Avoid stack contents exposure in error path
      - pmops check fix for S0ix vs S3
      - DCN 2.1 display fixes
      - DCN 2.0 display fix
      - Backlight control fix for laptops with HDR panels
      - Maintainers updates
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      From: Alex Deucher <alexander.deucher@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210729025817.4145-1-alexander.deucher@amd.com
      d28e2568
    • M
      alpha: register early reserved memory in memblock · 640b7ea5
      Mike Rapoport 提交于
      The memory reserved by console/PALcode or non-volatile memory is not added
      to memblock.memory.
      
      Since commit fa3354e4 (mm: free_area_init: use maximal zone PFNs rather
      than zone sizes) the initialization of the memory map relies on the
      accuracy of memblock.memory to properly calculate zone sizes. The holes in
      memblock.memory caused by absent regions reserved by the firmware cause
      incorrect initialization of struct pages which leads to BUG() during the
      initial page freeing:
      
      BUG: Bad page state in process swapper  pfn:2ffc53
      page:fffffc000ecf14c0 refcount:0 mapcount:1 mapping:0000000000000000 index:0x0
      flags: 0x0()
      raw: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
      raw: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
      page dumped because: nonzero mapcount
      Modules linked in:
      CPU: 0 PID: 0 Comm: swapper Not tainted 5.7.0-03841-gfa3354e4-dirty #26
             fffffc0001b5bd68 fffffc0001b5be80 fffffc00011cd148 fffffc000ecf14c0
             fffffc00019803df fffffc0001b5be80 fffffc00011ce340 fffffc000ecf14c0
             0000000000000000 fffffc0001b5be80 fffffc0001b482c0 fffffc00027d6618
             fffffc00027da7d0 00000000002ff97a 0000000000000000 fffffc0001b5be80
             fffffc00011d1abc fffffc000ecf14c0 fffffc0002d00000 fffffc0001b5be80
             fffffc0001b2350c 0000000000300000 fffffc0001b48298 fffffc0001b482c0
      Trace:
      [<fffffc00011cd148>] bad_page+0x168/0x1b0
      [<fffffc00011ce340>] free_pcp_prepare+0x1e0/0x290
      [<fffffc00011d1abc>] free_unref_page+0x2c/0xa0
      [<fffffc00014ee5f0>] cmp_ex_sort+0x0/0x30
      [<fffffc00014ee5f0>] cmp_ex_sort+0x0/0x30
      [<fffffc000101001c>] _stext+0x1c/0x20
      
      Fix this by registering the reserved ranges in memblock.memory.
      
      Link: https://lore.kernel.org/lkml/20210726192311.uffqnanxw3ac5wwi@ivybridge
      Fixes: fa3354e4 ("mm: free_area_init: use maximal zone PFNs rather than zone sizes")
      Reported-by: NMatt Turner <mattst88@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NMike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: NMatt Turner <mattst88@gmail.com>
      640b7ea5
    • D
      Merge tag 'drm-intel-fixes-2021-07-28' of... · 80c7917d
      Dave Airlie 提交于
      Merge tag 'drm-intel-fixes-2021-07-28' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes
      
      Display related fixes:
      - Fix vbt port mask
      - Fix around reading the right DSC disable fuse in display_ver 10
      - Split display version 9 and 10 in intel_setup_outputs
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      
      From: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/YQF63ruuE72x2T45@intel.com
      80c7917d
    • D
      Merge tag 'drm-misc-fixes-2021-07-28' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes · 89e7ffd3
      Dave Airlie 提交于
      Short summary of fixes pull:
      
       * panel: Fix bpc for ytc700tlag_05_201c
       * ttm: debugfs init fixes
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      
      From: Thomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/YQFTESngqkeqzlhN@linux-uq9g.fritz.box
      89e7ffd3
    • D
      Merge tag 'drm-msm-fixes-2021-07-27' of https://gitlab.freedesktop.org/drm/msm into drm-fixes · 792ca7e3
      Dave Airlie 提交于
      A few fixes for v5.14, including a fix for a crash if display triggers
      an iommu fault (which tends to happen at probe time on devices with
      bootloader fw that leaves display enabled as kernel starts)
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      From: Rob Clark <robdclark@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/CAF6AEGubeV_uzWhsqp_+EmQmPcPatnqWOQnARoing2YvQOHbyg@mail.gmail.com
      792ca7e3
    • L
      Merge tag 'fixes_for_v5.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs · 4010a528
      Linus Torvalds 提交于
      Pull ext2 and reiserfs fixes from Jan Kara:
       "A fix for the ext2 conversion to kmap_local() and two reiserfs
        hardening fixes"
      
      * tag 'fixes_for_v5.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
        reiserfs: check directory items on read from disk
        fs/ext2: Avoid page_address on pages returned by ext2_get_page
        reiserfs: add check for root_inode in reiserfs_fill_super
      4010a528
    • L
      Merge tag 'platform-drivers-x86-v5.14-2' of... · dfe49536
      Linus Torvalds 提交于
      Merge tag 'platform-drivers-x86-v5.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
      
      Pull x86 platform driver fixes from Hans de Goede:
       "A set of bug-fixes and new hardware ids.
      
        Highlights:
      
         - amd-pmc fixes
      
         - think-lmi fixes
      
         - various new hardware-ids"
      
      * tag 'platform-drivers-x86-v5.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
        platform/x86: gigabyte-wmi: add support for B550 Aorus Elite V2
        platform/x86: intel-hid: add Alder Lake ACPI device ID
        platform/x86: think-lmi: Fix possible mem-leaks on tlmi_analyze() error-exit
        platform/x86: think-lmi: Split kobject_init() and kobject_add() calls
        platform/x86: think-lmi: Move pending_reboot_attr to the attributes sysfs dir
        platform/x86: amd-pmc: Fix undefined reference to __udivdi3
        platform/x86: amd-pmc: Fix missing unlock on error in amd_pmc_send_cmd()
        platform/x86: wireless-hotkey: remove hardcoded "hp" from the error message
        platform/x86: amd-pmc: Use return code on suspend
        platform/x86: amd-pmc: Add new acpi id for future PMC controllers
        platform/x86: amd-pmc: Add support for ACPI ID AMDI0006
        platform/x86: amd-pmc: Add support for logging s0ix counters
        platform/x86: amd-pmc: Add support for logging SMU metrics
        platform/x86: amd-pmc: call dump registers only once
        platform/x86: amd-pmc: Fix SMU firmware reporting mechanism
        platform/x86: amd-pmc: Fix command completion code
        platform/x86: think-lmi: Add pending_reboot support
      dfe49536
    • T
      dmaengine: idxd: Change license on idxd.h to LGPL · 25905f60
      Tony Luck 提交于
      This file was given GPL-2.0 license. But LGPL-2.1 makes more sense
      as it needs to be used by libraries outside of the kernel source tree.
      Signed-off-by: NTony Luck <tony.luck@intel.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      25905f60
    • M
      af_unix: fix garbage collect vs MSG_PEEK · cbcf0112
      Miklos Szeredi 提交于
      unix_gc() assumes that candidate sockets can never gain an external
      reference (i.e.  be installed into an fd) while the unix_gc_lock is
      held.  Except for MSG_PEEK this is guaranteed by modifying inflight
      count under the unix_gc_lock.
      
      MSG_PEEK does not touch any variable protected by unix_gc_lock (file
      count is not), yet it needs to be serialized with garbage collection.
      Do this by locking/unlocking unix_gc_lock:
      
       1) increment file count
      
       2) lock/unlock barrier to make sure incremented file count is visible
          to garbage collection
      
       3) install file into fd
      
      This is a lock barrier (unlike smp_mb()) that ensures that garbage
      collection is run completely before or completely after the barrier.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cbcf0112
    • D
      btrfs: fix rw device counting in __btrfs_free_extra_devids · b2a61667
      Desmond Cheong Zhi Xi 提交于
      When removing a writeable device in __btrfs_free_extra_devids, the rw
      device count should be decremented.
      
      This error was caught by Syzbot which reported a warning in
      close_fs_devices:
      
        WARNING: CPU: 1 PID: 9355 at fs/btrfs/volumes.c:1168 close_fs_devices+0x763/0x880 fs/btrfs/volumes.c:1168
        Modules linked in:
        CPU: 0 PID: 9355 Comm: syz-executor552 Not tainted 5.13.0-rc1-syzkaller #0
        Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
        RIP: 0010:close_fs_devices+0x763/0x880 fs/btrfs/volumes.c:1168
        RSP: 0018:ffffc9000333f2f0 EFLAGS: 00010293
        RAX: ffffffff8365f5c3 RBX: 0000000000000001 RCX: ffff888029afd4c0
        RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
        RBP: ffff88802846f508 R08: ffffffff8365f525 R09: ffffed100337d128
        R10: ffffed100337d128 R11: 0000000000000000 R12: dffffc0000000000
        R13: ffff888019be8868 R14: 1ffff1100337d10d R15: 1ffff1100337d10a
        FS:  00007f6f53828700(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 000000000047c410 CR3: 00000000302a6000 CR4: 00000000001506f0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
         btrfs_close_devices+0xc9/0x450 fs/btrfs/volumes.c:1180
         open_ctree+0x8e1/0x3968 fs/btrfs/disk-io.c:3693
         btrfs_fill_super fs/btrfs/super.c:1382 [inline]
         btrfs_mount_root+0xac5/0xc60 fs/btrfs/super.c:1749
         legacy_get_tree+0xea/0x180 fs/fs_context.c:592
         vfs_get_tree+0x86/0x270 fs/super.c:1498
         fc_mount fs/namespace.c:993 [inline]
         vfs_kern_mount+0xc9/0x160 fs/namespace.c:1023
         btrfs_mount+0x3d3/0xb50 fs/btrfs/super.c:1809
         legacy_get_tree+0xea/0x180 fs/fs_context.c:592
         vfs_get_tree+0x86/0x270 fs/super.c:1498
         do_new_mount fs/namespace.c:2905 [inline]
         path_mount+0x196f/0x2be0 fs/namespace.c:3235
         do_mount fs/namespace.c:3248 [inline]
         __do_sys_mount fs/namespace.c:3456 [inline]
         __se_sys_mount+0x2f9/0x3b0 fs/namespace.c:3433
         do_syscall_64+0x3f/0xb0 arch/x86/entry/common.c:47
         entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Because fs_devices->rw_devices was not 0 after
      closing all devices. Here is the call trace that was observed:
      
        btrfs_mount_root():
          btrfs_scan_one_device():
            device_list_add();   <---------------- device added
          btrfs_open_devices():
            open_fs_devices():
              btrfs_open_one_device();   <-------- writable device opened,
      	                                     rw device count ++
          btrfs_fill_super():
            open_ctree():
              btrfs_free_extra_devids():
      	  __btrfs_free_extra_devids();  <--- writable device removed,
      	                              rw device count not decremented
      	  fail_tree_roots:
      	    btrfs_close_devices():
      	      close_fs_devices();   <------- rw device count off by 1
      
      As a note, prior to commit cf89af14 ("btrfs: dev-replace: fail
      mount if we don't have replace item with target device"), rw_devices
      was decremented on removing a writable device in
      __btrfs_free_extra_devids only if the BTRFS_DEV_STATE_REPLACE_TGT bit
      was not set for the device. However, this check does not need to be
      reinstated as it is now redundant and incorrect.
      
      In __btrfs_free_extra_devids, we skip removing the device if it is the
      target for replacement. This is done by checking whether device->devid
      == BTRFS_DEV_REPLACE_DEVID. Since BTRFS_DEV_STATE_REPLACE_TGT is set
      only on the device with devid BTRFS_DEV_REPLACE_DEVID, no devices
      should have the BTRFS_DEV_STATE_REPLACE_TGT bit set after the check,
      and so it's redundant to test for that bit.
      
      Additionally, following commit 82372bc8 ("Btrfs: make
      the logic of source device removing more clear"), rw_devices is
      incremented whenever a writeable device is added to the alloc
      list (including the target device in btrfs_dev_replace_finishing), so
      all removals of writable devices from the alloc list should also be
      accompanied by a decrement to rw_devices.
      
      Reported-by: syzbot+a70e2ad0879f160b9217@syzkaller.appspotmail.com
      Fixes: cf89af14 ("btrfs: dev-replace: fail mount if we don't have replace item with target device")
      CC: stable@vger.kernel.org # 5.10+
      Tested-by: syzbot+a70e2ad0879f160b9217@syzkaller.appspotmail.com
      Reviewed-by: NAnand Jain <anand.jain@oracle.com>
      Signed-off-by: NDesmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      b2a61667
    • F
      btrfs: fix lost inode on log replay after mix of fsync, rename and inode eviction · ecc64fab
      Filipe Manana 提交于
      When checking if we need to log the new name of a renamed inode, we are
      checking if the inode and its parent inode have been logged before, and if
      not we don't log the new name. The check however is buggy, as it directly
      compares the logged_trans field of the inodes versus the ID of the current
      transaction. The problem is that logged_trans is a transient field, only
      stored in memory and never persisted in the inode item, so if an inode
      was logged before, evicted and reloaded, its logged_trans field is set to
      a value of 0, meaning the check will return false and the new name of the
      renamed inode is not logged. If the old parent directory was previously
      fsynced and we deleted the logged directory entries corresponding to the
      old name, we end up with a log that when replayed will delete the renamed
      inode.
      
      The following example triggers the problem:
      
        $ mkfs.btrfs -f /dev/sdc
        $ mount /dev/sdc /mnt
      
        $ mkdir /mnt/A
        $ mkdir /mnt/B
        $ echo -n "hello world" > /mnt/A/foo
      
        $ sync
      
        # Add some new file to A and fsync directory A.
        $ touch /mnt/A/bar
        $ xfs_io -c "fsync" /mnt/A
      
        # Now trigger inode eviction. We are only interested in triggering
        # eviction for the inode of directory A.
        $ echo 2 > /proc/sys/vm/drop_caches
      
        # Move foo from directory A to directory B.
        # This deletes the directory entries for foo in A from the log, and
        # does not add the new name for foo in directory B to the log, because
        # logged_trans of A is 0, which is less than the current transaction ID.
        $ mv /mnt/A/foo /mnt/B/foo
      
        # Now make an fsync to anything except A, B or any file inside them,
        # like for example create a file at the root directory and fsync this
        # new file. This syncs the log that contains all the changes done by
        # previous rename operation.
        $ touch /mnt/baz
        $ xfs_io -c "fsync" /mnt/baz
      
        <power fail>
      
        # Mount the filesystem and replay the log.
        $ mount /dev/sdc /mnt
      
        # Check the filesystem content.
        $ ls -1R /mnt
        /mnt/:
        A
        B
        baz
      
        /mnt/A:
        bar
      
        /mnt/B:
        $
      
        # File foo is gone, it's neither in A/ nor in B/.
      
      Fix this by using the inode_logged() helper at btrfs_log_new_name(), which
      safely checks if an inode was logged before in the current transaction.
      
      A test case for fstests will follow soon.
      
      CC: stable@vger.kernel.org # 4.14+
      Signed-off-by: NFilipe Manana <fdmanana@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      ecc64fab
    • G
      btrfs: mark compressed range uptodate only if all bio succeed · 240246f6
      Goldwyn Rodrigues 提交于
      In compression write endio sequence, the range which the compressed_bio
      writes is marked as uptodate if the last bio of the compressed (sub)bios
      is completed successfully. There could be previous bio which may
      have failed which is recorded in cb->errors.
      
      Set the writeback range as uptodate only if cb->errors is zero, as opposed
      to checking only the last bio's status.
      
      Backporting notes: in all versions up to 4.4 the last argument is always
      replaced by "!cb->errors".
      
      CC: stable@vger.kernel.org # 4.4+
      Signed-off-by: NGoldwyn Rodrigues <rgoldwyn@suse.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      240246f6
  4. 28 7月, 2021 4 次提交