1. 15 Apr, 2022 4 commits
    • Linus Torvalds's avatar
      Merge tag 'io_uring-5.18-2022-04-14' of git://git.kernel.dk/linux-block · 0647b9cc
      Linus Torvalds authored
      Pull io_uring fixes from Jens Axboe:
      
       - Ensure we check and -EINVAL any use of reserved or struct padding.
      
         Although we generally always do that, it's missed in two spots for
         resource updates, one for the ring fd registration from this merge
         window, and one for the extended arg. Make sure we have all of them
         handled. (Dylan)
      
       - A few fixes for the deferred file assignment (me, Pavel)
      
       - Add a feature flag for the deferred file assignment so apps can tell
         we handle it correctly (me)
      
       - Fix a small perf regression with the current file position fix in
         this merge window (me)
      
      * tag 'io_uring-5.18-2022-04-14' of git://git.kernel.dk/linux-block:
        io_uring: abort file assignment prior to assigning creds
        io_uring: fix poll error reporting
        io_uring: fix poll file assign deadlock
        io_uring: use right issue_flags for splice/tee
        io_uring: verify pad field is 0 in io_get_ext_arg
        io_uring: verify resv is 0 in ringfd register/unregister
        io_uring: verify that resv2 is 0 in io_uring_rsrc_update2
        io_uring: move io_uring_rsrc_update2 validation
        io_uring: fix assign file locking issue
        io_uring: stop using io_wq_work as an fd placeholder
        io_uring: move apoll->events cache
        io_uring: io_kiocb_update_pos() should not touch file for non -1 offset
        io_uring: flag the fact that linked file assignment is sane
      0647b9cc
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-fixes-5.18-rc3' of... · bb34e0db
      Linus Torvalds authored
      Merge tag 'linux-kselftest-fixes-5.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull Kselftest fixes from Shuah Khan:
       "A mqueue perf test memory leak bug fix.
      
        mq_perf_tests failed to call CPU_FREE to free memory allocated by
        CPU_SET"
      
      * tag 'linux-kselftest-fixes-5.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        testing/selftests/mqueue: Fix mq_perf_tests to free the allocated cpu set
      bb34e0db
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-fixes-for-v5.18-2022-04-14' of... · e2dec488
      Linus Torvalds authored
      Merge tag 'perf-tools-fixes-for-v5.18-2022-04-14' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
      
      Pull perf tools fixes from Arnaldo Carvalho de Melo:
      
       - 'perf record --per-thread' mode doesn't have the CPU mask setup, so
         it can use it to figure out the number of mmaps, fix it.
      
       - Fix segfault accessing sample_id xyarray out of bounds, noticed while
         using Intel PT where we have a dummy event to capture text poke perf
         metadata events and we mixup the set of CPUs specified by the user
         with the all CPUs map needed for text poke.
      
       - Fix 'perf bench numa' to check if CPU used to bind task is online.
      
       - Fix 'perf bench numa' usage of affinity for machines with more than
         1000 CPUs.
      
       - Fix misleading add event PMU debug message, noticed while using the
        'intel_pt' PMU.
      
       - Fix error check return value of hashmap__new() in 'perf stat', it
         must use IS_ERR().
      
      * tag 'perf-tools-fixes-for-v5.18-2022-04-14' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
        perf bench: Fix numa bench to fix usage of affinity for machines with #CPUs > 1K
        perf bench: Fix numa testcase to check if CPU used to bind task is online
        perf record: Fix per-thread option
        perf tools: Fix segfault accessing sample_id xyarray
        perf stat: Fix error check return value of hashmap__new(), must use IS_ERR()
        perf tools: Fix misleading add event PMU debug message
      e2dec488
    • Jens Axboe's avatar
      io_uring: abort file assignment prior to assigning creds · 70152140
      Jens Axboe authored
      We need to either restore creds properly if we fail on the file
      assignment, or just do the file assignment first instead. Let's do
      the latter as it's simpler, should make no difference here for
      file assignment.
      
      Link: https://lore.kernel.org/lkml/000000000000a7edb305dca75a50@google.com/
      Reported-by: syzbot+60c52ca98513a8760a91@syzkaller.appspotmail.com
      Fixes: 6bf9c47a ("io_uring: defer file assignment")
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      70152140
  2. 14 Apr, 2022 27 commits
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2022-04-15' of git://anongit.freedesktop.org/drm/drm · 028192fe
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Eggs season holidays are among us, and I think I'd expect some smaller
        pulls for two weeks then.
      
        This seems eerily quiet. One i915 fix, amdgpu has a bunch and msm. I
        didn't see a misc pull this week, so I expect that will catch up next
        week.
      
        i915:
         - Correct legacy mmap disabling to use GRAPHICS_VER_FULL
      
        msm:
         - system suspend fix
         - kzalloc return checks
         - misc display fix
         - iommu_present removal
      
        amdgpu:
         - Fix for alpha properly in pre-multiplied mode
         - Fix VCN 3.1.2 firmware name
         - Suspend/resume fix
         - Add a gfxoff quirk for Mac vega20 board
         - DCN 3.1.6 spread spectrum fix"
      
      * tag 'drm-fixes-2022-04-15' of git://anongit.freedesktop.org/drm/drm:
        drm/amd/display: remove dtbclk_ss compensation for dcn316
        drm/amdgpu: Enable gfxoff quirk on MacBook Pro
        drm/amdgpu: Ensure HDA function is suspended before ASIC reset
        drm/amdgpu: fix VCN 3.1.2 firmware name
        drm/amd/display: don't ignore alpha property on pre-multiplied mode
        drm/msm/gpu: Avoid -Wunused-function with !CONFIG_PM_SLEEP
        drm/msm/dp: add fail safe mode outside of event_mutex context
        drm/msm/dsi: Use connector directly in msm_dsi_manager_connector_init()
        drm/msm: Stop using iommu_present()
        drm/msm/mdp5: check the return of kzalloc()
        drm/msm: Fix range size vs end confusion
        drm/i915: Sunset igpu legacy mmap support based on GRAPHICS_VER_FULL
        drm/msm/dpu: Use indexed array initializer to prevent mismatches
        drm/msm/disp: check the return value of kzalloc()
        dt-bindings: display/msm: another fix for the dpu-qcm2290 example
        drm/msm: Add missing put_task_struct() in debugfs path
        drm/msm/gpu: Remove mutex from wait_event condition
        drm/msm/gpu: Park scheduler threads for system suspend
        drm/msm/gpu: Rename runtime suspend/resume functions
      028192fe
    • Linus Torvalds's avatar
      Merge tag 'vfio-v5.18-rc3' of https://github.com/awilliam/linux-vfio · 38a5e3fb
      Linus Torvalds authored
      Pull vfio fix from Alex Williamson:
      
       - Fix VF token checking for vfio-pci variant drivers (Jason Gunthorpe)
      
      * tag 'vfio-v5.18-rc3' of https://github.com/awilliam/linux-vfio:
        vfio/pci: Fix vf_token mechanism when device-specific VF drivers are used
      38a5e3fb
    • Linus Torvalds's avatar
      Merge tag '5.18-rc2-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6 · 62345e48
      Linus Torvalds authored
      Pull cifs fixes from Steve French:
      
       - two fixes related to unmount
      
       - symlink overflow fix
      
       - minor netfs fix
      
       - improved tracing for crediting (flow control)
      
      * tag '5.18-rc2-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: verify that tcon is valid before dereference in cifs_kill_sb
        cifs: potential buffer overflow in handling symlinks
        cifs: Split the smb3_add_credits tracepoint
        cifs: release cached dentries only if mount is complete
        cifs: Check the IOCB_DIRECT flag, not O_DIRECT
      62345e48
    • NeilBrown's avatar
      VFS: filename_create(): fix incorrect intent. · b3d4650d
      NeilBrown authored
      When asked to create a path ending '/', but which is not to be a
      directory (LOOKUP_DIRECTORY not set), filename_create() will never try
      to create the file.  If it doesn't exist, -ENOENT is reported.
      
      However, it still passes LOOKUP_CREATE|LOOKUP_EXCL to the filesystems
      ->lookup() function, even though there is no intent to create.  This is
      misleading and can cause incorrect behaviour.
      
      If you try
      
         ln -s foo /path/dir/
      
      where 'dir' is a directory on an NFS filesystem which is not currently
      known in the dcache, this will fail with ENOENT.
      
      But as the name is not in the dcache, nfs_lookup gets called with
      LOOKUP_CREATE|LOOKUP_EXCL and so it returns NULL without performing any
      lookup, with the expectation that a subsequent call to create the target
      will be made, and the lookup can be combined with the creation.  In the
      case with a trailing '/' and no LOOKUP_DIRECTORY, that call is never
      made.  Instead filename_create() sees that the dentry is not (yet)
      positive and returns -ENOENT - even though the directory actually
      exists.
      
      So only set LOOKUP_CREATE|LOOKUP_EXCL if there really is an intent to
      create, and use the absence of these flags to decide if -ENOENT should
      be returned.
      
      Note that filename_parentat() is only interested in LOOKUP_REVAL, so we
      split that out and store it in 'reval_flag'.  __lookup_hash() then gets
      reval_flag combined with whatever create flags were determined to be
      needed.
      Reviewed-by: default avatarDavid Disseldorp <ddiss@suse.de>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b3d4650d
    • Dave Airlie's avatar
      Merge tag 'amd-drm-fixes-5.18-2022-04-13' of... · 8e401ff5
      Dave Airlie authored
      Merge tag 'amd-drm-fixes-5.18-2022-04-13' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
      
      amd-drm-fixes-5.18-2022-04-13:
      
      amdgpu:
      - Fix for alpha properly in pre-multiplied mode
      - Fix VCN 3.1.2 firmware name
      - Suspend/resume fix
      - Add a gfxoff quirk for Mac vega20 board
      - DCN 3.1.6 spread spectrum fix
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      From: Alex Deucher <alexander.deucher@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220414025821.5811-1-alexander.deucher@amd.com
      8e401ff5
    • Linus Torvalds's avatar
      Merge tag 's390-5.18-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 115acbb5
      Linus Torvalds authored
      Pull s390 fixes from Heiko Carstens:
      
       - Convert current_stack_pointer to a register alias like it is assumed
         if ARCH_HAS_CURRENT_STACK_POINTER is selected. The existing
         implementation as a function breaks CONFIG_HARDENED_USERCOPY
         sanity-checks
      
       - Get rid of -Warray-bounds warning within kexec code
      
       - Add minimal IBM z16 support by reporting a proper elf platform, and
         adding compile options
      
       - Update defconfigs
      
      * tag 's390-5.18-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390: enable CONFIG_HARDENED_USERCOPY in debug_defconfig
        s390: current_stack_pointer shouldn't be a function
        s390: update defconfigs
        s390/kexec: silence -Warray-bounds warning
        s390: allow to compile with z16 optimizations
        s390: add z16 elf platform
      115acbb5
    • Linus Torvalds's avatar
      Merge tag 'net-5.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · d20339fa
      Linus Torvalds authored
      Pull networking fixes from Paolo Abeni:
       "Including fixes from wireless and netfilter.
      
        Current release - regressions:
      
         - smc: fix af_ops of child socket pointing to released memory
      
         - wifi: ath9k: fix usage of driver-private space in tx_info
      
        Previous releases - regressions:
      
         - ipv6: fix panic when forwarding a pkt with no in6 dev
      
         - sctp: use the correct skb for security_sctp_assoc_request
      
         - smc: fix NULL pointer dereference in smc_pnet_find_ib()
      
         - sched: fix initialization order when updating chain 0 head
      
         - phy: don't defer probe forever if PHY IRQ provider is missing
      
         - dsa: revert "net: dsa: setup master before ports"
      
         - dsa: felix: fix tagging protocol changes with multiple CPU ports
      
         - eth: ice:
            - fix use-after-free when freeing @rx_cpu_rmap
            - revert "iavf: fix deadlock occurrence during resetting VF
              interface"
      
         - eth: lan966x: stop processing the MAC entry is port is wrong
      
        Previous releases - always broken:
      
         - sched:
            - flower: fix parsing of ethertype following VLAN header
            - taprio: check if socket flags are valid
      
         - nfc: add flush_workqueue to prevent uaf
      
         - veth: ensure eth header is in skb's linear part
      
         - eth: stmmac: fix altr_tse_pcs function when using a fixed-link
      
         - eth: macb: restart tx only if queue pointer is lagging
      
         - eth: macvlan: fix leaking skb in source mode with nodst option"
      
      * tag 'net-5.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (52 commits)
        net: bcmgenet: Revert "Use stronger register read/writes to assure ordering"
        rtnetlink: Fix handling of disabled L3 stats in RTM_GETSTATS replies
        net: dsa: felix: fix tagging protocol changes with multiple CPU ports
        tun: annotate access to queue->trans_start
        nfc: nci: add flush_workqueue to prevent uaf
        net: dsa: realtek: don't parse compatible string for RTL8366S
        net: dsa: realtek: fix Kconfig to assure consistent driver linkage
        net: ftgmac100: access hardware register after clock ready
        Revert "net: dsa: setup master before ports"
        macvlan: Fix leaking skb in source mode with nodst option
        netfilter: nf_tables: nft_parse_register can return a negative value
        net: lan966x: Stop processing the MAC entry is port is wrong.
        net: lan966x: Fix when a port's upper is changed.
        net: lan966x: Fix IGMP snooping when frames have vlan tag
        net: lan966x: Update lan966x_ptp_get_nominal_value
        sctp: Initialize daddr on peeled off socket
        net/smc: Fix af_ops of child socket pointing to released memory
        net/smc: Fix NULL pointer dereference in smc_pnet_find_ib()
        net/smc: use memcpy instead of snprintf to avoid out of bounds read
        net: macb: Restart tx only if queue pointer is lagging
        ...
      d20339fa
    • Linus Torvalds's avatar
      Merge tag 'sound-5.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · b9b4c79e
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "This became an unexpectedly large pull request due to various
        regression fixes in the previous kernels.
      
        The majority of fixes are a series of patches to address the
        regression at probe errors in devres'ed drivers, while there are yet
        more fixes for the x86 SG allocations and for USB-audio buffer
        management. In addition, a few HD-audio quirks and other small fixes
        are found"
      
      * tag 'sound-5.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (52 commits)
        ALSA: usb-audio: Limit max buffer and period sizes per time
        ALSA: memalloc: Add fallback SG-buffer allocations for x86
        ALSA: nm256: Don't call card private_free at probe error path
        ALSA: mtpav: Don't call card private_free at probe error path
        ALSA: rme9652: Fix the missing snd_card_free() call at probe error
        ALSA: hdspm: Fix the missing snd_card_free() call at probe error
        ALSA: hdsp: Fix the missing snd_card_free() call at probe error
        ALSA: oxygen: Fix the missing snd_card_free() call at probe error
        ALSA: lx6464es: Fix the missing snd_card_free() call at probe error
        ALSA: cmipci: Fix the missing snd_card_free() call at probe error
        ALSA: aw2: Fix the missing snd_card_free() call at probe error
        ALSA: als300: Fix the missing snd_card_free() call at probe error
        ALSA: lola: Fix the missing snd_card_free() call at probe error
        ALSA: bt87x: Fix the missing snd_card_free() call at probe error
        ALSA: sis7019: Fix the missing error handling
        ALSA: intel_hdmi: Fix the missing snd_card_free() call at probe error
        ALSA: via82xx: Fix the missing snd_card_free() call at probe error
        ALSA: sonicvibes: Fix the missing snd_card_free() call at probe error
        ALSA: rme96: Fix the missing snd_card_free() call at probe error
        ALSA: rme32: Fix the missing snd_card_free() call at probe error
        ...
      b9b4c79e
    • Linus Torvalds's avatar
      Merge tag 'for-5.18-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 722985e2
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
       "A few more code and warning fixes.
      
        There's one feature ioctl removal patch slated for 5.18 that did not
        make it to the main pull request. It's just a one-liner and the ioctl
        has a v2 that's in use for a long time, no point to postpone it to
        5.19.
      
        Late update:
      
         - remove balance v1 ioctl, superseded by v2 in 2012
      
        Fixes:
      
         - add back cgroup attribution for compressed writes
      
         - add super block write start/end annotations to asynchronous balance
      
         - fix root reference count on an error handling path
      
         - in zoned mode, activate zone at the chunk allocation time to avoid
           ENOSPC due to timing issues
      
         - fix delayed allocation accounting for direct IO
      
        Warning fixes:
      
         - simplify assertion condition in zoned check
      
         - remove an unused variable"
      
      * tag 'for-5.18-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: fix btrfs_submit_compressed_write cgroup attribution
        btrfs: fix root ref counts in error handling in btrfs_get_root_ref
        btrfs: zoned: activate block group only for extent allocation
        btrfs: return allocated block group from do_chunk_alloc()
        btrfs: mark resumed async balance as writing
        btrfs: remove support of balance v1 ioctl
        btrfs: release correct delalloc amount in direct IO write path
        btrfs: remove unused variable in btrfs_{start,write}_dirty_block_groups()
        btrfs: zoned: remove redundant condition in btrfs_run_delalloc_range
      722985e2
    • Linus Torvalds's avatar
      Merge tag 'fscache-fixes-20220413' of... · ec9c57a7
      Linus Torvalds authored
      Merge tag 'fscache-fixes-20220413' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs
      
      Pull fscache fixes from David Howells:
       "Here's a collection of fscache and cachefiles fixes and misc small
        cleanups. The two main fixes are:
      
         - Add a missing unmark of the inode in-use mark in an error path.
      
         - Fix a KASAN slab-out-of-bounds error when setting the xattr on a
           cachefiles volume due to the wrong length being given to memcpy().
      
        In addition, there's the removal of an unused parameter, removal of an
        unused Kconfig option, conditionalising a bit of procfs-related stuff
        and some doc fixes"
      
      * tag 'fscache-fixes-20220413' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
        fscache: remove FSCACHE_OLD_API Kconfig option
        fscache: Use wrapper fscache_set_cache_state() directly when relinquishing
        fscache: Move fscache_cookies_seq_ops specific code under CONFIG_PROC_FS
        fscache: Remove the cookie parameter from fscache_clear_page_bits()
        docs: filesystems: caching/backend-api.rst: fix an object withdrawn API
        docs: filesystems: caching/backend-api.rst: correct two relinquish APIs use
        cachefiles: Fix KASAN slab-out-of-bounds in cachefiles_set_volume_xattr
        cachefiles: unmark inode in use in error path
      ec9c57a7
    • Athira Rajeev's avatar
      perf bench: Fix numa bench to fix usage of affinity for machines with #CPUs > 1K · f58faed7
      Athira Rajeev authored
      The 'perf bench numa' testcase fails on systems with more than 1K CPUs.
      
      Testcase: perf bench numa mem -p 1 -t 3 -P 512 -s 100 -zZ0qcm --thp  1
      
      Snippet of code:
      
        <<>>
        perf: bench/numa.c:302: bind_to_node: Assertion `!(ret)' failed.
        Aborted (core dumped)
        <<>>
      
      bind_to_node() uses "sched_getaffinity" to save the original cpumask and
      this call is returning EINVAL ((invalid argument).
      
      This happens because the default mask size in glibc is 1024.  To
      overcome this 1024 CPUs mask size limitation of cpu_set_t, change the
      mask size using the CPU_*_S macros ie, use CPU_ALLOC to allocate
      cpumask, CPU_ALLOC_SIZE for size.
      
      Apart from fixing this for "orig_mask", apply same logic to "mask" as
      well which is used to setaffinity so that mask size is large enough to
      represent number of possible CPU's in the system.
      
      sched_getaffinity is used in one more place in perf numa bench. It is in
      "bind_to_cpu" function. Apply the same logic there also. Though
      currently no failure is reported from there, it is ideal to change
      getaffinity to work with such system configurations having CPU's more
      than default mask size supported by glibc.
      
      Also fix "sched_setaffinity" to use mask size which is large enough to
      represent number of possible CPU's in the system.
      
      Fixed all places where "bind_cpumask" which is part of "struct
      thread_data" is used such that bind_cpumask works in all configuration.
      Reported-by: default avatarDisha Goel <disgoel@linux.vnet.ibm.com>
      Signed-off-by: default avatarAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: https://lore.kernel.org/r/20220412164059.42654-3-atrajeev@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f58faed7
    • Athira Rajeev's avatar
      perf bench: Fix numa testcase to check if CPU used to bind task is online · 8cb7a188
      Athira Rajeev authored
      Perf numa bench test fails with error:
      
      Testcase:
      
        ./perf bench numa mem -p 2 -t 1 -P 1024 -C 0,8 -M 1,0 -s 20 -zZq --thp  1 --no-data_rand_walk
      
      Failure snippet:
      
      <<>>
        Running 'numa/mem' benchmark:
      
        # Running main, "perf bench numa numa-mem -p 2 -t 1 -P 1024 -C 0,8 -M 1,0 -s 20 -zZq --thp 1 --no-data_rand_walk"
      
        perf: bench/numa.c:333: bind_to_cpumask: Assertion `!(ret)' failed.
      <<>>
      
      The Testcases uses CPU's 0 and 8. In function "parse_setup_cpu_list",
      There is check to see if cpu number is greater than max cpu's possible
      in the system ie via "if (bind_cpu_0 >= g->p.nr_cpus || bind_cpu_1 >=
      g->p.nr_cpus) {".
      
      But it could happen that system has say 48 CPU's, but only number of
      online CPU's is 0-7. Other CPU's are offlined. Since "g->p.nr_cpus" is
      48, so function will go ahead and set bit for CPU 8 also in cpumask (
      td->bind_cpumask).
      
      bind_to_cpumask function is called to set affinity using
      sched_setaffinity and the cpumask. Since the CPU8 is not present, set
      affinity will fail here with EINVAL.
      
      Fix this issue by adding a check to make sure that, CPU's provided in
      the input argument values are online before proceeding further and skip
      the test. For this, include new helper function "is_cpu_online" in
      "tools/perf/util/header.c".
      
      Since "BIT(x)" definition will get included from header.h, remove
      that from bench/numa.c
      Reported-by: default avatarDisha Goel <disgoel@linux.vnet.ibm.com>
      Signed-off-by: default avatarAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Tested-by: default avatarDisha Goel <disgoel@linux.vnet.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: https://lore.kernel.org/r/20220412164059.42654-2-atrajeev@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8cb7a188
    • Alexey Bayduraev's avatar
      perf record: Fix per-thread option · 23380e4d
      Alexey Bayduraev authored
      Per-thread mode doesn't have specific CPUs for events, add checks for
      this case.
      
      Minor fix to a pr_debug by Ian Rogers <irogers@google.com> to avoid an
      out of bound array access.
      
      Fixes: 7954f716 ("perf record: Introduce thread affinity and mmap masks")
      Reported-by: default avatarIan Rogers <irogers@google.com>
      Signed-off-by: default avatarAlexey Bayduraev <alexey.bayduraev@gmail.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20220414014642.3308206-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      23380e4d
    • Jeremy Linton's avatar
      net: bcmgenet: Revert "Use stronger register read/writes to assure ordering" · 2df3fc4a
      Jeremy Linton authored
      It turns out after digging deeper into this bug, that it was being
      triggered by GCC12 failing to call the bcmgenet_enable_dma()
      routine. Given that a gcc12 fix has been merged [1] and the genet
      driver now works properly when built with gcc12, this commit should
      be reverted.
      
      [1]
      https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105160
      https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=aabb9a261ef060cf24fd626713f1d7d9df81aa57
      
      Fixes: 8d3ea3d4 ("net: bcmgenet: Use stronger register read/writes to assure ordering")
      Signed-off-by: default avatarJeremy Linton <jeremy.linton@arm.com>
      Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20220412210420.1129430-1-jeremy.linton@arm.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      2df3fc4a
    • Petr Machata's avatar
      rtnetlink: Fix handling of disabled L3 stats in RTM_GETSTATS replies · 23cfe941
      Petr Machata authored
      When L3 stats are disabled, rtnl_offload_xstats_get_size_stats() returns
      size of 0, which is supposed to be an indication that the corresponding
      attribute should not be emitted. However, instead, the current code
      reserves a 0-byte attribute.
      
      The reason this does not show up as a citation on a kasan kernel is that
      netdev_offload_xstats_get(), which is supposed to fill in the data, never
      ends up getting called, because rtnl_offload_xstats_get_stats() notices
      that the stats are not actually used and skips the call.
      
      Thus a zero-length IFLA_OFFLOAD_XSTATS_L3_STATS attribute ends up in a
      response, confusing the userspace.
      
      Fix by skipping the L3-stats related block in rtnl_offload_xstats_fill().
      
      Fixes: 0e7788fd ("net: rtnetlink: Add UAPI for obtaining L3 offload xstats")
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/591b58e7623edc3eb66dd1fcfa8c8f133d090974.1649794741.git.petrm@nvidia.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      23cfe941
    • Vladimir Oltean's avatar
      net: dsa: felix: fix tagging protocol changes with multiple CPU ports · 00fa91bc
      Vladimir Oltean authored
      When the device tree has 2 CPU ports defined, a single one is active
      (has any dp->cpu_dp pointers point to it). Yet the second one is still a
      CPU port, and DSA still calls ->change_tag_protocol on it.
      
      On the NXP LS1028A, the CPU ports are ports 4 and 5. Port 4 is the
      active CPU port and port 5 is inactive.
      
      After the following commands:
      
       # Initial setting
       cat /sys/class/net/eno2/dsa/tagging
       ocelot
       echo ocelot-8021q > /sys/class/net/eno2/dsa/tagging
       echo ocelot > /sys/class/net/eno2/dsa/tagging
      
      traffic is now broken, because the driver has moved the NPI port from
      port 4 to port 5, unbeknown to DSA.
      
      The problem can be avoided by detecting that the second CPU port is
      unused, and not doing anything for it. Further rework will be needed
      when proper support for multiple CPU ports is added.
      
      Treat this as a bug and prepare current kernels to work in single-CPU
      mode with multiple-CPU DT blobs.
      
      Fixes: adb3dccf ("net: dsa: felix: convert to the new .change_tag_protocol DSA API")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Link: https://lore.kernel.org/r/20220412172209.2531865-1-vladimir.oltean@nxp.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      00fa91bc
    • Antoine Tenart's avatar
      tun: annotate access to queue->trans_start · 968a1a5d
      Antoine Tenart authored
      Commit 5337824f ("net: annotate accesses to queue->trans_start")
      introduced a new helper, txq_trans_cond_update, to update
      queue->trans_start using WRITE_ONCE. One snippet in drivers/net/tun.c
      was missed, as it was introduced roughly at the same time.
      
      Fixes: 5337824f ("net: annotate accesses to queue->trans_start")
      Cc: Eric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarAntoine Tenart <atenart@kernel.org>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20220412135852.466386-1-atenart@kernel.orgSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      968a1a5d
    • Ronnie Sahlberg's avatar
      cifs: verify that tcon is valid before dereference in cifs_kill_sb · 8b6c5845
      Ronnie Sahlberg authored
      On umount, cifs_sb->tlink_tree might contain entries that do not represent
      a valid tcon.
      Check the tcon for error before we dereference it.
      Signed-off-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarShyam Prasad N <sprasad@microsoft.com>
      Reported-by: default avatarXiaoli Feng <xifeng@redhat.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      8b6c5845
    • Dave Airlie's avatar
      Merge tag 'drm-msm-fixes-2022-04-13' of https://gitlab.freedesktop.org/drm/msm into drm-fixes · 98a71d12
      Dave Airlie authored
      Some msm fixes for v5.18.
      
      kzalloc return checks, display fix, misc locking and scheduler bug, iommu present removal.
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      From: Rob Clark <robdclark@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/CAF6AEGvuTwx09MKwK68KWXqi4o7LxDGMUz1=Z7xOS+i=OV84Ug@mail.gmail.com
      98a71d12
    • Dave Airlie's avatar
      Merge tag 'drm-intel-fixes-2022-04-13' of... · 16e04007
      Dave Airlie authored
      Merge tag 'drm-intel-fixes-2022-04-13' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes
      
      - Correct legacy mmap disabling to use GRAPHICS_VER_FULL
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/YlZma8iA20iakK62@jlahtine-mobl.ger.corp.intel.com
      16e04007
    • Charlene Liu's avatar
      drm/amd/display: remove dtbclk_ss compensation for dcn316 · aadaeca4
      Charlene Liu authored
      [why]
      dcn316's dtbclk is from non_ss clock source.
      no compensation required here.
      Reviewed-by: default avatarChris Park <Chris.Park@amd.com>
      Acked-by: default avatarPavle Kotarac <Pavle.Kotarac@amd.com>
      Signed-off-by: default avatarCharlene Liu <Charlene.Liu@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      aadaeca4
    • Tomasz Moń's avatar
      drm/amdgpu: Enable gfxoff quirk on MacBook Pro · 4593c1b6
      Tomasz Moń authored
      Enabling gfxoff quirk results in perfectly usable graphical user
      interface on MacBook Pro (15-inch, 2019) with Radeon Pro Vega 20 4 GB.
      
      Without the quirk, X server is completely unusable as every few seconds
      there is gpu reset due to ring gfx timeout.
      Signed-off-by: default avatarTomasz Moń <desowin@gmail.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      4593c1b6
    • Kai-Heng Feng's avatar
      drm/amdgpu: Ensure HDA function is suspended before ASIC reset · 887f75cf
      Kai-Heng Feng authored
      DP/HDMI audio on AMD PRO VII stops working after S3:
      [  149.450391] amdgpu 0000:63:00.0: amdgpu: MODE1 reset
      [  149.450395] amdgpu 0000:63:00.0: amdgpu: GPU mode1 reset
      [  149.450494] amdgpu 0000:63:00.0: amdgpu: GPU psp mode1 reset
      [  149.983693] snd_hda_intel 0000:63:00.1: refused to change power state from D0 to D3hot
      [  150.003439] amdgpu 0000:63:00.0: refused to change power state from D0 to D3hot
      ...
      [  155.432975] snd_hda_intel 0000:63:00.1: CORB reset timeout#2, CORBRP = 65535
      
      The offending commit is daf8de08 ("drm/amdgpu: always reset the asic in
      suspend (v2)"). Commit 34452ac3 ("drm/amdgpu: don't use BACO for
      reset in S3 ") doesn't help, so the issue is something different.
      
      Assuming that to make HDA resume to D0 fully realized, it needs to be
      successfully put to D3 first. And this guesswork proves working, by
      moving amdgpu_asic_reset() to noirq callback, so it's called after HDA
      function is in D3.
      
      Fixes: daf8de08 ("drm/amdgpu: always reset the asic in suspend (v2)")
      Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      887f75cf
    • Alex Deucher's avatar
      drm/amdgpu: fix VCN 3.1.2 firmware name · e3cf2e05
      Alex Deucher authored
      Drop the trailing vcn.
      
      Fixes: afc2f276 ("drm/amdgpu/vcn: add vcn support for vcn 3.1.2")
      Reviewed-by: default avatarJames Zhu <James.Zhu@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      e3cf2e05
    • Melissa Wen's avatar
      drm/amd/display: don't ignore alpha property on pre-multiplied mode · e4f1541c
      Melissa Wen authored
      "Pre-multiplied" is the default pixel blend mode for KMS/DRM, as
      documented in supported_modes of drm_plane_create_blend_mode_property():
      https://cgit.freedesktop.org/drm/drm-misc/tree/drivers/gpu/drm/drm_blend.c
      
      In this mode, both 'pixel alpha' and 'plane alpha' participate in the
      calculation, as described by the pixel blend mode formula in KMS/DRM
      documentation:
      
      out.rgb = plane_alpha * fg.rgb +
                (1 - (plane_alpha * fg.alpha)) * bg.rgb
      
      Considering the blend config mechanisms we have in the driver so far,
      the alpha mode that better fits this blend mode is the
      _PER_PIXEL_ALPHA_COMBINED_GLOBAL_GAIN, where the value for global_gain
      is the plane alpha (global_alpha).
      
      With this change, alpha property stops to be ignored. It also addresses
      Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1734
      
      v2:
       * keep the 8-bit value for global_alpha_value (Nicholas)
       * correct the logical ordering for combined global gain (Nicholas)
       * apply to dcn10 too (Nicholas)
      Signed-off-by: default avatarMelissa Wen <mwen@igalia.com>
      Tested-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
      Tested-by: default avatarSimon Ser <contact@emersion.fr>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      e4f1541c
    • Adrian Hunter's avatar
      perf tools: Fix segfault accessing sample_id xyarray · a668cc07
      Adrian Hunter authored
      perf_evsel::sample_id is an xyarray which can cause a segfault when
      accessed beyond its size. e.g.
      
        # perf record -e intel_pt// -C 1 sleep 1
        Segmentation fault (core dumped)
        #
      
      That is happening because a dummy event is opened to capture text poke
      events accross all CPUs, however the mmap logic is allocating according
      to the number of user_requested_cpus.
      
      In general, perf sometimes uses the evsel cpus to open events, and
      sometimes the evlist user_requested_cpus. However, it is not necessary
      to determine which case is which because the opened event file
      descriptors are also in an xyarray, the size of whch can be used
      to correctly allocate the size of the sample_id xyarray, because there
      is one ID per file descriptor.
      
      Note, in the affected code path, perf_evsel fd array is subsequently
      used to get the file descriptor for the mmap, so it makes sense for the
      xyarrays to be the same size there.
      
      Fixes: d1a17759 ("libperf: Adopt perf_evlist__mmap()/munmap() from tools/perf")
      Fixes: 246eba8e ("perf tools: Add support for PERF_RECORD_TEXT_POKE")
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: stable@vger.kernel.org # 5.5+
      Link: https://lore.kernel.org/r/20220413114232.26914-1-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a668cc07
    • Lv Ruyi's avatar
      perf stat: Fix error check return value of hashmap__new(), must use IS_ERR() · d73f5d14
      Lv Ruyi authored
      hashmap__new() returns ERR_PTR(-ENOMEM) when it fails, so we should use
      IS_ERR() to check it in error handling path.
      Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
      Signed-off-by: default avatarLv Ruyi <lv.ruyi@zte.com.cn>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220413093302.2538128-1-lv.ruyi@zte.com.cnSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d73f5d14
  3. 13 Apr, 2022 9 commits
    • Jason Gunthorpe's avatar
      vfio/pci: Fix vf_token mechanism when device-specific VF drivers are used · 1ef3342a
      Jason Gunthorpe authored
      get_pf_vdev() tries to check if a PF is a VFIO PF by looking at the driver:
      
             if (pci_dev_driver(physfn) != pci_dev_driver(vdev->pdev)) {
      
      However now that we have multiple VF and PF drivers this is no longer
      reliable.
      
      This means that security tests realted to vf_token can be skipped by
      mixing and matching different VFIO PCI drivers.
      
      Instead of trying to use the driver core to find the PF devices maintain a
      linked list of all PF vfio_pci_core_device's that we have called
      pci_enable_sriov() on.
      
      When registering a VF just search the list to see if the PF is present and
      record the match permanently in the struct. PCI core locking prevents a PF
      from passing pci_disable_sriov() while VF drivers are attached so the VFIO
      owned PF becomes a static property of the VF.
      
      In common cases where vfio does not own the PF the global list remains
      empty and the VF's pointer is statically NULL.
      
      This also fixes a lockdep splat from recursive locking of the
      vfio_group::device_lock between vfio_device_get_from_name() and
      vfio_device_get_from_dev(). If the VF and PF share the same group this
      would deadlock.
      
      Fixes: ff53edf6 ("vfio/pci: Split the pci_driver code out of vfio_pci_core.c")
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Link: https://lore.kernel.org/r/0-v3-876570980634+f2e8-vfio_vf_token_jgg@nvidia.comSigned-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      1ef3342a
    • Harshit Mogalapalli's avatar
      cifs: potential buffer overflow in handling symlinks · 64c4a37a
      Harshit Mogalapalli authored
      Smatch printed a warning:
      	arch/x86/crypto/poly1305_glue.c:198 poly1305_update_arch() error:
      	__memcpy() 'dctx->buf' too small (16 vs u32max)
      
      It's caused because Smatch marks 'link_len' as untrusted since it comes
      from sscanf(). Add a check to ensure that 'link_len' is not larger than
      the size of the 'link_str' buffer.
      
      Fixes: c69c1b6e ("cifs: implement CIFSParseMFSymlink()")
      Signed-off-by: default avatarHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
      Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      64c4a37a
    • Pavel Begunkov's avatar
      io_uring: fix poll error reporting · 7179c3ce
      Pavel Begunkov authored
      We should not return an error code in req->result in
      io_poll_check_events(), because it may get mangled and returned as
      success. Just return the error code directly, the callers will fail the
      request or proceed accordingly.
      
      Fixes: 6bf9c47a ("io_uring: defer file assignment")
      Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
      Link: https://lore.kernel.org/r/5f03514ee33324dc811fb93df84aee0f695fb044.1649862516.git.asml.silence@gmail.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
      7179c3ce
    • Pavel Begunkov's avatar
      io_uring: fix poll file assign deadlock · cce64ef0
      Pavel Begunkov authored
      We pass "unlocked" into io_assign_file() in io_poll_check_events(),
      which can lead to double locking.
      
      Fixes: 6bf9c47a ("io_uring: defer file assignment")
      Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
      Link: https://lore.kernel.org/r/2476d4ae46554324b599ee4055447b105f20a75a.1649862516.git.asml.silence@gmail.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
      cce64ef0
    • Pavel Begunkov's avatar
      io_uring: use right issue_flags for splice/tee · e9419766
      Pavel Begunkov authored
      Pass right issue_flags into into io_file_get_fixed() instead of
      IO_URING_F_UNLOCKED. It's probably not a problem at the moment but let's
      do it safer.
      
      Fixes: 6bf9c47a ("io_uring: defer file assignment")
      Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
      Link: https://lore.kernel.org/r/7d242daa9df5d776907686977cd29fbceb4a2d8d.1649862516.git.asml.silence@gmail.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
      e9419766
    • Lin Ma's avatar
      nfc: nci: add flush_workqueue to prevent uaf · ef27324e
      Lin Ma authored
      Our detector found a concurrent use-after-free bug when detaching an
      NCI device. The main reason for this bug is the unexpected scheduling
      between the used delayed mechanism (timer and workqueue).
      
      The race can be demonstrated below:
      
      Thread-1                           Thread-2
                                       | nci_dev_up()
                                       |   nci_open_device()
                                       |     __nci_request(nci_reset_req)
                                       |       nci_send_cmd
                                       |         queue_work(cmd_work)
      nci_unregister_device()          |
        nci_close_device()             | ...
          del_timer_sync(cmd_timer)[1] |
      ...                              | Worker
      nci_free_device()                | nci_cmd_work()
        kfree(ndev)[3]                 |   mod_timer(cmd_timer)[2]
      
      In short, the cleanup routine thought that the cmd_timer has already
      been detached by [1] but the mod_timer can re-attach the timer [2], even
      it is already released [3], resulting in UAF.
      
      This UAF is easy to trigger, crash trace by POC is like below
      
      [   66.703713] ==================================================================
      [   66.703974] BUG: KASAN: use-after-free in enqueue_timer+0x448/0x490
      [   66.703974] Write of size 8 at addr ffff888009fb7058 by task kworker/u4:1/33
      [   66.703974]
      [   66.703974] CPU: 1 PID: 33 Comm: kworker/u4:1 Not tainted 5.18.0-rc2 #5
      [   66.703974] Workqueue: nfc2_nci_cmd_wq nci_cmd_work
      [   66.703974] Call Trace:
      [   66.703974]  <TASK>
      [   66.703974]  dump_stack_lvl+0x57/0x7d
      [   66.703974]  print_report.cold+0x5e/0x5db
      [   66.703974]  ? enqueue_timer+0x448/0x490
      [   66.703974]  kasan_report+0xbe/0x1c0
      [   66.703974]  ? enqueue_timer+0x448/0x490
      [   66.703974]  enqueue_timer+0x448/0x490
      [   66.703974]  __mod_timer+0x5e6/0xb80
      [   66.703974]  ? mark_held_locks+0x9e/0xe0
      [   66.703974]  ? try_to_del_timer_sync+0xf0/0xf0
      [   66.703974]  ? lockdep_hardirqs_on_prepare+0x17b/0x410
      [   66.703974]  ? queue_work_on+0x61/0x80
      [   66.703974]  ? lockdep_hardirqs_on+0xbf/0x130
      [   66.703974]  process_one_work+0x8bb/0x1510
      [   66.703974]  ? lockdep_hardirqs_on_prepare+0x410/0x410
      [   66.703974]  ? pwq_dec_nr_in_flight+0x230/0x230
      [   66.703974]  ? rwlock_bug.part.0+0x90/0x90
      [   66.703974]  ? _raw_spin_lock_irq+0x41/0x50
      [   66.703974]  worker_thread+0x575/0x1190
      [   66.703974]  ? process_one_work+0x1510/0x1510
      [   66.703974]  kthread+0x2a0/0x340
      [   66.703974]  ? kthread_complete_and_exit+0x20/0x20
      [   66.703974]  ret_from_fork+0x22/0x30
      [   66.703974]  </TASK>
      [   66.703974]
      [   66.703974] Allocated by task 267:
      [   66.703974]  kasan_save_stack+0x1e/0x40
      [   66.703974]  __kasan_kmalloc+0x81/0xa0
      [   66.703974]  nci_allocate_device+0xd3/0x390
      [   66.703974]  nfcmrvl_nci_register_dev+0x183/0x2c0
      [   66.703974]  nfcmrvl_nci_uart_open+0xf2/0x1dd
      [   66.703974]  nci_uart_tty_ioctl+0x2c3/0x4a0
      [   66.703974]  tty_ioctl+0x764/0x1310
      [   66.703974]  __x64_sys_ioctl+0x122/0x190
      [   66.703974]  do_syscall_64+0x3b/0x90
      [   66.703974]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      [   66.703974]
      [   66.703974] Freed by task 406:
      [   66.703974]  kasan_save_stack+0x1e/0x40
      [   66.703974]  kasan_set_track+0x21/0x30
      [   66.703974]  kasan_set_free_info+0x20/0x30
      [   66.703974]  __kasan_slab_free+0x108/0x170
      [   66.703974]  kfree+0xb0/0x330
      [   66.703974]  nfcmrvl_nci_unregister_dev+0x90/0xd0
      [   66.703974]  nci_uart_tty_close+0xdf/0x180
      [   66.703974]  tty_ldisc_kill+0x73/0x110
      [   66.703974]  tty_ldisc_hangup+0x281/0x5b0
      [   66.703974]  __tty_hangup.part.0+0x431/0x890
      [   66.703974]  tty_release+0x3a8/0xc80
      [   66.703974]  __fput+0x1f0/0x8c0
      [   66.703974]  task_work_run+0xc9/0x170
      [   66.703974]  exit_to_user_mode_prepare+0x194/0x1a0
      [   66.703974]  syscall_exit_to_user_mode+0x19/0x50
      [   66.703974]  do_syscall_64+0x48/0x90
      [   66.703974]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      To fix the UAF, this patch adds flush_workqueue() to ensure the
      nci_cmd_work is finished before the following del_timer_sync.
      This combination will promise the timer is actually detached.
      
      Fixes: 6a2968aa ("NFC: basic NCI protocol implementation")
      Signed-off-by: default avatarLin Ma <linma@zju.edu.cn>
      Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ef27324e
    • Alvin Šipraga's avatar
      net: dsa: realtek: don't parse compatible string for RTL8366S · 8e925de6
      Alvin Šipraga authored
      This switch is not even supported, but if someone were to actually put
      this compatible string "realtek,rtl8366s" in their device tree, they
      would be greeted with a kernel panic because the probe function would
      dereference NULL. So let's just remove it.
      
      Link: https://lore.kernel.org/all/CACRpkdYdKZs0WExXc3=0yPNOwP+oOV60HRz7SRoGjZvYHaT=1g@mail.gmail.com/Signed-off-by: default avatarAlvin Šipraga <alsi@bang-olufsen.dk>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8e925de6
    • Alvin Šipraga's avatar
      net: dsa: realtek: fix Kconfig to assure consistent driver linkage · 2511e0c8
      Alvin Šipraga authored
      The kernel test robot reported a build failure:
      
      or1k-linux-ld: drivers/net/dsa/realtek/realtek-smi.o:(.rodata+0x16c): undefined reference to `rtl8366rb_variant'
      
      ... with the following build configuration:
      
      CONFIG_NET_DSA_REALTEK=y
      CONFIG_NET_DSA_REALTEK_SMI=y
      CONFIG_NET_DSA_REALTEK_RTL8365MB=y
      CONFIG_NET_DSA_REALTEK_RTL8366RB=m
      
      The problem here is that the realtek-smi interface driver gets built-in,
      while the rtl8366rb switch subdriver gets built as a module, hence the
      symbol rtl8366rb_variant is not reachable when defining the OF device
      table in the interface driver.
      
      The Kconfig dependencies don't help in this scenario because they just
      say that the subdriver(s) depend on at least one interface driver. In
      fact, the subdrivers don't depend on the interface drivers at all, and
      can even be built even in their absence. Somewhat strangely, the
      interface drivers can also be built in the absence of any subdriver,
      BUT, if a subdriver IS enabled, then it must be reachable according to
      the linkage of the interface driver: effectively what the IS_REACHABLE()
      macro achieves. If it is not reachable, the above kind of linker error
      will be observed.
      
      Rather than papering over the above build error by simply using
      IS_REACHABLE(), we can do a little better and admit that it is actually
      the interface drivers that have a dependency on the subdrivers. So this
      patch does exactly that. Specifically, we ensure that:
      
      1. The interface drivers' Kconfig symbols must have a value no greater
         than the value of any subdriver Kconfig symbols.
      
      2. The subdrivers should by default enable both interface drivers, since
         most users probably want at least one of them; those interface
         drivers can be explicitly disabled however.
      
      What this doesn't do is prevent a user from building only a subdriver,
      without any interface driver. To that end, add an additional line of
      help in the menu to guide users in the right direction.
      
      Link: https://lore.kernel.org/all/202204110757.XIafvVnj-lkp@intel.com/Reported-by: default avatarkernel test robot <lkp@intel.com>
      Fixes: aac94001 ("net: dsa: realtek: add new mdio interface for drivers")
      Signed-off-by: default avatarAlvin Šipraga <alsi@bang-olufsen.dk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2511e0c8
    • David S. Miller's avatar
      Merge tag 'wireless-2022-04-13' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless · dad32cfe
      David S. Miller authored
      Kalle Valo says:
      
      ====================
      wireless fixes for v5.18
      
      First set of fixes for v5.18. Maintainers file updates, two
      compilation warning fixes, one revert for ath11k and smaller fixes to
      drivers and stack. All the usual stuff.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dad32cfe