Skip to content
  1. Jun 03, 2023
    • Namjae Jeon's avatar
      ksmbd: fix posix_acls and acls dereferencing possible ERR_PTR() · 25933573
      Namjae Jeon authored
      Dan reported the following error message:
      
      fs/smb/server/smbacl.c:1296 smb_check_perm_dacl()
          error: 'posix_acls' dereferencing possible ERR_PTR()
      fs/smb/server/vfs.c:1323 ksmbd_vfs_make_xattr_posix_acl()
          error: 'posix_acls' dereferencing possible ERR_PTR()
      fs/smb/server/vfs.c:1830 ksmbd_vfs_inherit_posix_acl()
          error: 'acls' dereferencing possible ERR_PTR()
      
      __get_acl() returns a mix of error pointers and NULL. This change it
      with IS_ERR_OR_NULL().
      
      Fixes: e2f34481
      
       ("cifsd: add server-side procedures for SMB3")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      25933573
    • Namjae Jeon's avatar
      ksmbd: fix out-of-bound read in parse_lease_state() · fc6c6a3c
      Namjae Jeon authored
      
      
      This bug is in parse_lease_state, and it is caused by the missing check
      of `struct create_context`. When the ksmbd traverses the create_contexts,
      it doesn't check if the field of `NameOffset` and `Next` is valid,
      The KASAN message is following:
      
      [    6.664323] BUG: KASAN: slab-out-of-bounds in parse_lease_state+0x7d/0x280
      [    6.664738] Read of size 2 at addr ffff888005c08988 by task kworker/0:3/103
      ...
      [    6.666644] Call Trace:
      [    6.666796]  <TASK>
      [    6.666933]  dump_stack_lvl+0x33/0x50
      [    6.667167]  print_report+0xcc/0x620
      [    6.667903]  kasan_report+0xae/0xe0
      [    6.668374]  kasan_check_range+0x35/0x1b0
      [    6.668621]  parse_lease_state+0x7d/0x280
      [    6.668868]  smb2_open+0xbe8/0x4420
      [    6.675137]  handle_ksmbd_work+0x282/0x820
      
      Use smb2_find_context_vals() to find smb2 create request lease context.
      smb2_find_context_vals validate create context fields.
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatarChih-Yen Chang <cc85nod@gmail.com>
      Tested-by: default avatarChih-Yen Chang <cc85nod@gmail.com>
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      fc6c6a3c
    • Namjae Jeon's avatar
      ksmbd: fix out-of-bound read in deassemble_neg_contexts() · f1a41187
      Namjae Jeon authored
      
      
      The check in the beginning is
      `clen + sizeof(struct smb2_neg_context) <= len_of_ctxts`,
      but in the end of loop, `len_of_ctxts` will subtract
      `((clen + 7) & ~0x7) + sizeof(struct smb2_neg_context)`, which causes
      integer underflow when clen does the 8 alignment. We should use
      `(clen + 7) & ~0x7` in the check to avoid underflow from happening.
      
      Then there are some variables that need to be declared unsigned
      instead of signed.
      
      [   11.671070] BUG: KASAN: slab-out-of-bounds in smb2_handle_negotiate+0x799/0x1610
      [   11.671533] Read of size 2 at addr ffff888005e86cf2 by task kworker/0:0/7
      ...
      [   11.673383] Call Trace:
      [   11.673541]  <TASK>
      [   11.673679]  dump_stack_lvl+0x33/0x50
      [   11.673913]  print_report+0xcc/0x620
      [   11.674671]  kasan_report+0xae/0xe0
      [   11.675171]  kasan_check_range+0x35/0x1b0
      [   11.675412]  smb2_handle_negotiate+0x799/0x1610
      [   11.676217]  ksmbd_smb_negotiate_common+0x526/0x770
      [   11.676795]  handle_ksmbd_work+0x274/0x810
      ...
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarChih-Yen Chang <cc85nod@gmail.com>
      Tested-by: default avatarChih-Yen Chang <cc85nod@gmail.com>
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      f1a41187
  2. Jun 01, 2023
    • Linus Torvalds's avatar
      Merge tag '6.4-rc4-smb3-server-fixes' of git://git.samba.org/ksmbd · 88280037
      Linus Torvalds authored
      Pull smb server fixes from Steve French:
       "Eight server fixes (most also for stable):
      
         - Two fixes for uninitialized pointer reads (rename and link)
      
         - Fix potential UAF in oplock break
      
         - Two fixes for potential out of bound reads in negotiate
      
         - Fix crediting bug
      
         - Two fixes for xfstests (allocation size fix for test 694 and lookup
           issue shown by test 464)"
      
      * tag '6.4-rc4-smb3-server-fixes' of git://git.samba.org/ksmbd:
        ksmbd: call putname after using the last component
        ksmbd: fix incorrect AllocationSize set in smb2_get_info
        ksmbd: fix UAF issue from opinfo->conn
        ksmbd: fix multiple out-of-bounds read during context decoding
        ksmbd: fix slab-out-of-bounds read in smb2_handle_negotiate
        ksmbd: fix credit count leakage
        ksmbd: fix uninitialized pointer read in smb2_create_link()
        ksmbd: fix uninitialized pointer read in ksmbd_vfs_rename()
      88280037
    • Linus Torvalds's avatar
      Merge tag '6.4-rc4-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6 · 929ed21d
      Linus Torvalds authored
      Pull smb client fixes from Steve French:
       "Four small smb3 client fixes:
      
         - two small fixes suggested by kernel test robot
      
         - small cleanup fix
      
         - update Paulo's email address in the maintainer file"
      
      * tag '6.4-rc4-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: address unused variable warning
        smb: delete an unnecessary statement
        smb3: missing null check in SMB2_change_notify
        smb3: update a reviewer email in MAINTAINERS file
      929ed21d
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma · 884fe9da
      Linus Torvalds authored
      Pull rdma fixes from Jason Gunthorpe:
      
       - Fix 64K ARM page size support in bnxt_re and efa
      
       - bnxt_re fixes for a memory leak, incorrect error handling and a
         remove a bogus FW failure when running on a VF
      
       - Update MAINTAINERS for hns and efa
      
       - Fix two rxe regressions added this merge window in error unwind and
         incorrect spinlock primitives
      
       - hns gets a better algorithm for allocating page tables to avoid
         running out of resources, and a timeout adjustment
      
       - Fix a text case failure in hns
      
       - Use after free in irdma and fix incorrect construction of a WQE
         causing mis-execution
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
        RDMA/irdma: Fix Local Invalidate fencing
        RDMA/irdma: Prevent QP use after free
        MAINTAINERS: Update maintainer of Amazon EFA driver
        RDMA/bnxt_re: Do not enable congestion control on VFs
        RDMA/bnxt_re: Fix return value of bnxt_re_process_raw_qp_pkt_rx
        RDMA/bnxt_re: Fix a possible memory leak
        RDMA/hns: Modify the value of long message loopback slice
        RDMA/hns: Fix base address table allocation
        RDMA/hns: Fix timeout attr in query qp for HIP08
        RDMA/efa: Fix unsupported page sizes in device
        RDMA/rxe: Convert spin_{lock_bh,unlock_bh} to spin_{lock_irqsave,unlock_irqrestore}
        RDMA/rxe: Fix double unlock in rxe_qp.c
        MAINTAINERS: Update maintainers of HiSilicon RoCE
        RDMA/bnxt_re: Fix the page_size used during the MR creation
      884fe9da
    • Linus Torvalds's avatar
      Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · fd2186d1
      Linus Torvalds authored
      Pull ext4 fixes from Ted Ts'o:
       "Fix two regressions in ext4 and a number of issues reported by syzbot"
      
      * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        ext4: enable the lazy init thread when remounting read/write
        ext4: fix fsync for non-directories
        ext4: add lockdep annotations for i_data_sem for ea_inode's
        ext4: disallow ea_inodes with extended attributes
        ext4: set lockdep subclass for the ea_inode in ext4_xattr_inode_cache_find()
        ext4: add EA_INODE checking to ext4_iget()
      fd2186d1
  3. May 31, 2023
  4. May 30, 2023
  5. May 29, 2023
    • Linus Torvalds's avatar
      Merge tag 'trace-v6.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace · 8b817fde
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
       "User events:
      
         - Use long instead of int for storing the enable set/clear bit, as it
           was found that big endian machines could end up using the wrong
           bits.
      
         - Split allocating mm and attaching it. This keeps the allocation
           separate from the registration and avoids various races.
      
         - Remove RCU locking around pin_user_pages_remote() as that can
           schedule. The RCU protection is no longer needed with the above
           split of mm allocation and attaching.
      
         - Rename the "link" fields of the various structs to something more
           meaningful.
      
         - Add comments around user_event_mm struct usage and locking
           requirements.
      
        Timerlat tracer:
      
         - Fix missed wakeup of timerlat thread caused by the timerlat
           interrupt triggering when tracing is off. The timer interrupt
           handler needs to always wake up the timerlat thread regardless if
           tracing is enabled or not, otherwise, it will never wake up.
      
        Histograms:
      
         - Fix regression of breaking the "stacktrace" modifier for variables.
           That modifier cannot be used for values, but can be used for
           variables that are passed from one histogram to the next. This was
           broken when adding the restriction to values as the variable logic
           used the same code.
      
         - Rename the special field "stacktrace" to "common_stacktrace".
      
           Special fields (that are not actually part of the event, but can
           act just like event fields, like 'comm' and 'timestamp') should be
           prefixed with 'common_' for consistency. To keep backward
           compatibility, 'stacktrace' can still be used (as with the special
           field 'cpu'), but can be overridden if the event has a field called
           'stacktrace'.
      
         - Update the synthetic event selftests to use the new name (synthetic
           events are created by histograms)
      
        Tracing bootup selftests:
      
         - Reorganize the code to keep artifacts of the selftests not compiled
           in when selftests are not configured.
      
         - Add various cond_resched() around the selftest code, as the
           softlock watchdog was triggering much more often. It appears that
           the kernel runs slower now with full debugging enabled.
      
         - While debugging ftrace with ftrace (using an instance ring buffer
           instead of the top level one), I found that the selftests were
           disabling prints to the debug instance.
      
           This should not happen, as the selftests only disable printing to
           the main buffer as the selftests examine the main buffer to see if
           it has what it expects, and prints can make the tests fail.
      
           Make the selftests only disable printing to the toplevel buffer,
           and leave the instance buffers alone"
      
      * tag 'trace-v6.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        tracing: Have function_graph selftest call cond_resched()
        tracing: Only make selftest conditionals affect the global_trace
        tracing: Make tracing_selftest_running/delete nops when not used
        tracing: Have tracer selftests call cond_resched() before running
        tracing: Move setting of tracing_selftest_running out of register_tracer()
        tracing/selftests: Update synthetic event selftest to use common_stacktrace
        tracing: Rename stacktrace field to common_stacktrace
        tracing/histograms: Allow variables to have some modifiers
        tracing/user_events: Document user_event_mm one-shot list usage
        tracing/user_events: Rename link fields for clarity
        tracing/user_events: Remove RCU lock while pinning pages
        tracing/user_events: Split up mm alloc and attach
        tracing/timerlat: Always wakeup the timerlat thread
        tracing/user_events: Use long vs int for atomic bit ops
      8b817fde
    • Linus Torvalds's avatar
      Merge tag 'v6.4-p3' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 · 7a6c8e51
      Linus Torvalds authored
      Pull crypto fix from Herbert Xu:
       "Fix an alignment crash in x86/aria"
      
      * tag 'v6.4-p3' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
        crypto: x86/aria - Use 16 byte alignment for GFNI constant vectors
      7a6c8e51
    • Linus Torvalds's avatar
      Revert "module: error out early on concurrent load of the same module file" · ac2263b5
      Linus Torvalds authored
      This reverts commit 9828ed3f
      
      .
      
      Sadly, it does seem to cause failures to load modules. Johan Hovold reports:
      
       "This change breaks module loading during boot on the Lenovo Thinkpad
        X13s (aarch64).
      
        Specifically it results in indefinite probe deferral of the display
        and USB (ethernet) which makes it a pain to debug. Typing in the dark
        to acquire some logs reveals that other modules are missing as well"
      
      Since this was applied late as a "let's try this", I'm reverting it
      asap, and we can try to figure out what goes wrong later.  The excessive
      parallel module loading problem is annoying, but not noticeable in
      normal situations, and this was only meant as an optimistic workaround
      for a user-space bug.
      
      One possible solution may be to do the optimistic exclusive open first,
      and then use a lock to serialize loading if that fails.
      
      Reported-by: default avatarJohan Hovold <johan@kernel.org>
      Link: https://lore.kernel.org/lkml/ZHRpH-JXAxA6DnzR@hovoldconsulting.com/
      
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ac2263b5
    • Steven Rostedt (Google)'s avatar
      tracing: Have function_graph selftest call cond_resched() · a2d910f0
      Steven Rostedt (Google) authored
      When all kernel debugging is enabled (lockdep, KSAN, etc), the function
      graph enabling and disabling can take several seconds to complete. The
      function_graph selftest enables and disables function graph tracing
      several times. With full debugging enabled, the soft lockup watchdog was
      triggering because the selftest was running without ever scheduling.
      
      Add cond_resched() throughout the test to make sure it does not trigger
      the soft lockup detector.
      
      Link: https://lkml.kernel.org/r/20230528051742.1325503-6-rostedt@goodmis.org
      
      
      
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      a2d910f0
    • Steven Rostedt (Google)'s avatar
      tracing: Only make selftest conditionals affect the global_trace · ac9d2cb1
      Steven Rostedt (Google) authored
      The tracing_selftest_running and tracing_selftest_disabled variables were
      to keep trace_printk() and other writes from affecting the tracing
      selftests, as the tracing selftests would examine the ring buffer to see
      if it contained what it expected or not. trace_printk() and friends could
      add to the ring buffer and cause the selftests to fail (and then disable
      the tracer that was being tested). To keep that from happening, these
      variables were added and would keep trace_printk() and friends from
      writing to the ring buffer while the tests were going on.
      
      But this was only the top level ring buffer (owned by the global_trace
      instance). There is no reason to prevent writing into ring buffers of
      other instances via the trace_array_printk() and friends. For the
      functions that could be used by other instances, check if the global_trace
      is the tracer instance that is being written to before deciding to not
      allow the write.
      
      Link: https://lkml.kernel.org/r/20230528051742.1325503-5-rostedt@goodmis.org
      
      
      
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      ac9d2cb1
    • Steven Rostedt (Google)'s avatar
      tracing: Make tracing_selftest_running/delete nops when not used · a3ae76d7
      Steven Rostedt (Google) authored
      There's no reason to test the condition variables tracing_selftest_running
      or tracing_selftest_delete when tracing selftests are not enabled. Make
      them define 0s when not the selftests are not configured in.
      
      Link: https://lkml.kernel.org/r/20230528051742.1325503-4-rostedt@goodmis.org
      
      
      
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      a3ae76d7
    • Steven Rostedt (Google)'s avatar
      tracing: Have tracer selftests call cond_resched() before running · 9da705d4
      Steven Rostedt (Google) authored
      As there are more and more internal selftests being added to the Linux
      kernel (KSAN, lockdep, etc) the selftests are taking longer to run when
      these are enabled. Add a cond_resched() to the calling of
      do_run_tracer_selftest() to force a schedule if NEED_RESCHED is set,
      otherwise the soft lockup watchdog may trigger on boot up.
      
      Link: https://lkml.kernel.org/r/20230528051742.1325503-3-rostedt@goodmis.org
      
      
      
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      9da705d4
    • Steven Rostedt (Google)'s avatar
      tracing: Move setting of tracing_selftest_running out of register_tracer() · e8352cf5
      Steven Rostedt (Google) authored
      The variables tracing_selftest_running and tracing_selftest_disabled are
      only used for when CONFIG_FTRACE_STARTUP_TEST is enabled. Make them only
      visible within the selftest code. The setting of those variables are in
      the register_tracer() call, and set in a location where they do not need
      to be. Create a wrapper around run_tracer_selftest() called
      do_run_tracer_selftest() which sets those variables, and have
      register_tracer() call that instead.
      
      Having those variables only set within the CONFIG_FTRACE_STARTUP_TEST
      scope gets rid of them (and also the ability to remove testing against
      them) when the startup tests are not enabled (most cases).
      
      Link: https://lkml.kernel.org/r/20230528051742.1325503-2-rostedt@goodmis.org
      
      
      
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      e8352cf5
    • Linus Torvalds's avatar
      Merge tag 'phy-fixes-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy · e338142b
      Linus Torvalds authored
      Pull phy fixes from Vinod Koul:
      
       - init count imbalance fix in qcom-qmp-pcie and combo drivers
      
       - kernel doc header fix for qcom-snps driver
      
       - mediatek floating point comparison fix
      
       - amlogic fix register value
      
      * tag 'phy-fixes-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy:
        phy: qcom-snps: correct struct qcom_snps_hsphy kerneldoc
        phy: amlogic: phy-meson-g12a-mipi-dphy-analog: fix CNTL2_DIF_TX_CTL0 value
        phy: mediatek: rework the floating point comparisons to fixed point
        phy: qcom-qmp-pcie-msm8996: fix init-count imbalance
        phy: qcom-qmp-combo: fix init-count imbalance
      e338142b
    • Linus Torvalds's avatar
      Merge tag 'dmaengine-fix-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine · dca389eb
      Linus Torvalds authored
      Pull dmaengine fixes from Vinod Koul:
       "Driver fixes for the at-hdmac, pl330, TI and IDXD drivers:
      
         - AT HDMAC driver fixes for Flow Controller bitfield, peripheral ID
           handling and potential NULL dereference check
      
         - PL330 function rename to avoid conflicts
      
         - build warning fix for pm function in TI driver
      
         - IDXD driver fix for passing freed memory"
      
      * tag 'dmaengine-fix-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine:
        dmaengine: at_hdmac: Extend the Flow Controller bitfield to three bits
        dmaengine: at_hdmac: Repair bitfield macros for peripheral ID handling
        dmaengine: pl330: rename _start to prevent build error
        dmaengine: at_xdmac: fix potential Oops in at_xdmac_prep_interleaved()
        dmaengine: ti: k3-udma: annotate pm function with __maybe_unused
        dmaengine: idxd: Fix passing freed memory in idxd_cdev_open()
      dca389eb
    • Theodore Ts'o's avatar
      ext4: add EA_INODE checking to ext4_iget() · b3e6bcb9
      Theodore Ts'o authored
      
      
      Add a new flag, EXT4_IGET_EA_INODE which indicates whether the inode
      is expected to have the EA_INODE flag or not.  If the flag is not
      set/clear as expected, then fail the iget() operation and mark the
      file system as corrupted.
      
      This commit also makes the ext4_iget() always perform the
      is_bad_inode() check even when the inode is already inode cache.  This
      allows us to remove the is_bad_inode() check from the callers of
      ext4_iget() in the ea_inode code.
      
      Reported-by: default avatar <syzbot+cbb68193bdb95af4340a@syzkaller.appspotmail.com>
      Reported-by: default avatar <syzbot+62120febbd1ee3c3c860@syzkaller.appspotmail.com>
      Reported-by: default avatar <syzbot+edce54daffee36421b4c@syzkaller.appspotmail.com>
      Cc: stable@kernel.org
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Link: https://lore.kernel.org/r/20230524034951.779531-2-tytso@mit.edu
      
      
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      b3e6bcb9
  6. May 28, 2023