Skip to content
  1. Nov 09, 2022
    • Athira Rajeev's avatar
      perf stat: Fix printing os->prefix in CSV metrics output · ad353b71
      Athira Rajeev authored
      'perf stat' with CSV output option prints an extra empty string as first
      field in metrics output line.  Sample output below:
      
      	# ./perf stat -x, --per-socket -a -C 1 ls
      	S0,1,1.78,msec,cpu-clock,1785146,100.00,0.973,CPUs utilized
      	S0,1,26,,context-switches,1781750,100.00,0.015,M/sec
      	S0,1,1,,cpu-migrations,1780526,100.00,0.561,K/sec
      	S0,1,1,,page-faults,1779060,100.00,0.561,K/sec
      	S0,1,875807,,cycles,1769826,100.00,0.491,GHz
      	S0,1,85281,,stalled-cycles-frontend,1767512,100.00,9.74,frontend cycles idle
      	S0,1,576839,,stalled-cycles-backend,1766260,100.00,65.86,backend cycles idle
      	S0,1,288430,,instructions,1762246,100.00,0.33,insn per cycle
      ====>	,S0,1,,,,,,,2.00,stalled cycles per insn
      
      The above command line uses field separator as "," via "-x," option and
      per-socket option displays socket value as first field. But here the
      last line for "stalled cycles per insn" has "," in the beginning.
      
      Sample output using interval mode:
      
      	# ./perf stat -I 1000 -x, --per-socket -a -C 1 ls
      	0.001813453,S0,1,1.87,msec,cpu-clock,1872052,100.00,0.002,CPUs utilized
      	0.001813453,S0,1,2,,context-switches,1868028,100.00,1.070,K/sec
      	------
      	0.001813453,S0,1,85379,,instructions,1856754,100.00,0.32,insn per cycle
      ====>	0.001813453,,S0,1,,,,,,,1.34,stalled cycles per insn
      
      Above result also has an extra CSV separator after
      the timestamp. Patch addresses extra field separator
      in the beginning of the metric output line.
      
      The counter stats are displayed by function
      "perf_stat__print_shadow_stats" in code
      "util/stat-shadow.c". While printing the stats info
      for "stalled cycles per insn", function "new_line_csv"
      is used as new_line callback.
      
      The new_line_csv function has check for "os->prefix"
      and if prefix is not null, it will be printed along
      with cvs separator.
      Snippet from "new_line_csv":
      	if (os->prefix)
                     fprintf(os->fh, "%s%s", os->prefix, config->csv_sep);
      
      Here os->prefix gets printed followed by ","
      which is the cvs separator. The os->prefix is
      used in interval mode option ( -I ), to print
      time stamp on every new line. But prefix is
      already set to contain CSV separator when used
      in interval mode for CSV option.
      
      Reference: Function "static void print_interval"
      Snippet:
      	sprintf(prefix, "%6lu.%09lu%s", ts->tv_sec, ts->tv_nsec, config->csv_sep);
      
      Also if prefix is not assigned (if not used with
      -I option), it gets set to empty string.
      Reference: function printout() in util/stat-display.c
      Snippet:
      	.prefix = prefix ? prefix : "",
      
      Since prefix already set to contain cvs_sep in interval
      option, patch removes printing config->csv_sep in
      new_line_csv function to avoid printing extra field.
      
      After the patch:
      
      	# ./perf stat -x, --per-socket -a -C 1 ls
      	S0,1,2.04,msec,cpu-clock,2045202,100.00,1.013,CPUs utilized
      	S0,1,2,,context-switches,2041444,100.00,979.289,/sec
      	S0,1,0,,cpu-migrations,2040820,100.00,0.000,/sec
      	S0,1,2,,page-faults,2040288,100.00,979.289,/sec
      	S0,1,254589,,cycles,2036066,100.00,0.125,GHz
      	S0,1,82481,,stalled-cycles-frontend,2032420,100.00,32.40,frontend cycles idle
      	S0,1,113170,,stalled-cycles-backend,2031722,100.00,44.45,backend cycles idle
      	S0,1,88766,,instructions,2030942,100.00,0.35,insn per cycle
      	S0,1,,,,,,,1.27,stalled cycles per insn
      
      Fixes: 92a61f64
      
       ("perf stat: Implement CSV metrics output")
      Reported-by: default avatarDisha Goel <disgoel@linux.vnet.ibm.com>
      Reviewed-By: default avatarKajol Jain <kjain@linux.ibm.com>
      Signed-off-by: default avatarAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Tested-by: default avatarDisha Goel <disgoel@linux.vnet.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20221018085605.63834-1-atrajeev@linux.vnet.ibm.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ad353b71
    • Namhyung Kim's avatar
      perf stat: Fix crash with --per-node --metric-only in CSV mode · 84d1b201
      Namhyung Kim authored
      The following command will get segfault due to missing aggr_header_csv
      for AGGR_NODE:
      
        $ sudo perf stat -a --per-node -x, --metric-only true
      
      Committer testing:
      
      Before this patch:
      
        # perf stat -a --per-node -x, --metric-only true
        Segmentation fault (core dumped)
        #
      
      After:
      
        # gdb perf
        -bash: gdb: command not found
        # perf stat -a --per-node -x, --metric-only true
        node,Ghz,frontend cycles idle,backend cycles idle,insn per cycle,branch-misses of all branches,
        N0,32,0.335,2.10,0.65,0.69,0.03,1.92,
        #
      
      Fixes: 86895b48
      
       ("perf stat: Add --per-node agregation support")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: http://lore.kernel.org/lkml/20221107213314.3239159-2-namhyung@kernel.org
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      84d1b201
  2. Nov 08, 2022
    • Liam Howlett's avatar
      fs/userfaultfd: Fix maple tree iterator in userfaultfd_unregister() · 59f2f4b8
      Liam Howlett authored
      
      
      When iterating the VMAs, the maple state needs to be invalidated if the
      tree is modified by a split or merge to ensure the maple tree node
      contained in the maple state is still valid.  These invalidations were
      missed, so add them to the paths which alter the tree.
      
      Reported-by: default avatar <syzbot+0d2014e4da2ccced5b41@syzkaller.appspotmail.com>
      Fixes: 69dbe6da
      
       (userfaultfd: use maple tree iterator to iterate VMAs)
      Signed-off-by: default avatarLiam R. Howlett <Liam.Howlett@oracle.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      59f2f4b8
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v6.1-3' of... · a1de832b
      Linus Torvalds authored
      Merge tag 'platform-drivers-x86-v6.1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
      
      Pull x86 platform driver fixes from Hans de Goede:
       "The most important fixes here are a set of fixes for the ACPI
        backlight detection refactor which landed in 6.1.
      
        These fix regressions reported on some laptop models by making
        acpi_video_backlight_use_native() always return true for now, which in
        essence undoes some of the changes.
      
        I plan to take another shot at having only 1 /sys/class/backlight
        class device per panel with 6.2, with modified detection heuristics to
        avoid the (known) regressions.
      
        Highlights:
      
         - ACPI: video: Fix regressions from 6.1 backlight refactor by making
           acpi_video_backlight_use_native() always return true for now
      
         - Misc other bugfixes and HW id additions"
      
      * tag 'platform-drivers-x86-v6.1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
        platform/x86: p2sb: Don't fail if unknown CPU is found
        platform/x86/intel/hid: Add some ACPI device IDs
        platform/x86/intel/pmt: Sapphire Rapids PMT errata fix
        platform/x86: hp_wmi: Fix rfkill causing soft blocked wifi
        platform/x86: touchscreen_dmi: Add info for the RCA Cambio W101 v2 2-in-1
        platform/x86: ideapad-laptop: Disable touchpad_switch
        ACPI: video: Add backlight=native DMI quirk for Dell G15 5515
        ACPI: video: Make acpi_video_backlight_use_native() always return true
        ACPI: video: Improve Chromebook checks
      a1de832b
  3. Nov 07, 2022
  4. Nov 06, 2022
    • Paolo Bonzini's avatar
      Merge tag 'kvmarm-fixes-6.1-3' of... · f4298cac
      Paolo Bonzini authored
      Merge tag 'kvmarm-fixes-6.1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD
      
      * Fix the pKVM stage-1 walker erronously using the stage-2 accessor
      
      * Correctly convert vcpu->kvm to a hyp pointer when generating
        an exception in a nVHE+MTE configuration
      
      * Check that KVM_CAP_DIRTY_LOG_* are valid before enabling them
      
      * Fix SMPRI_EL1/TPIDR2_EL0 trapping on VHE
      
      * Document the boot requirements for FGT when entering the kernel
        at EL1
      f4298cac
    • Paolo Bonzini's avatar
      Merge branch 'kvm-master' into HEAD · 14620149
      Paolo Bonzini authored
      x86:
      * Use SRCU to protect zap in __kvm_set_or_clear_apicv_inhibit()
      
      * Make argument order consistent for kvcalloc()
      
      * Userspace API fixes for DEBUGCTL and LBRs
      14620149
    • Theodore Ts'o's avatar
      ext4: fix fortify warning in fs/ext4/fast_commit.c:1551 · 0d043351
      Theodore Ts'o authored
      With the new fortify string system, rework the memcpy to avoid this
      warning:
      
      memcpy: detected field-spanning write (size 60) of single field "&raw_inode->i_generation" at fs/ext4/fast_commit.c:1551 (size 4)
      
      Cc: stable@kernel.org
      Fixes: 54d9469b
      
       ("fortify: Add run-time WARN for cross-field memcpy()")
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      0d043351
    • Jason Yan's avatar
      ext4: fix wrong return err in ext4_load_and_init_journal() · 9f2a1d9f
      Jason Yan authored
      The return value is wrong in ext4_load_and_init_journal(). The local
      variable 'err' need to be initialized before goto out. The original code
      in __ext4_fill_super() is fine because it has two return values 'ret'
      and 'err' and 'ret' is initialized as -EINVAL. After we factor out
      ext4_load_and_init_journal(), this code is broken. So fix it by directly
      returning -EINVAL in the error handler path.
      
      Cc: stable@kernel.org
      Fixes: 9c1dd22d
      
       ("ext4: factor out ext4_load_and_init_journal()")
      Signed-off-by: default avatarJason Yan <yanaijie@huawei.com>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Link: https://lore.kernel.org/r/20221025040206.3134773-1-yanaijie@huawei.com
      
      
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      9f2a1d9f
    • Ye Bin's avatar
      ext4: fix warning in 'ext4_da_release_space' · 1b8f787e
      Ye Bin authored
      
      
      Syzkaller report issue as follows:
      EXT4-fs (loop0): Free/Dirty block details
      EXT4-fs (loop0): free_blocks=0
      EXT4-fs (loop0): dirty_blocks=0
      EXT4-fs (loop0): Block reservation details
      EXT4-fs (loop0): i_reserved_data_blocks=0
      EXT4-fs warning (device loop0): ext4_da_release_space:1527: ext4_da_release_space: ino 18, to_free 1 with only 0 reserved data blocks
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 92 at fs/ext4/inode.c:1528 ext4_da_release_space+0x25e/0x370 fs/ext4/inode.c:1524
      Modules linked in:
      CPU: 0 PID: 92 Comm: kworker/u4:4 Not tainted 6.0.0-syzkaller-09423-g493ffd6605b2 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
      Workqueue: writeback wb_workfn (flush-7:0)
      RIP: 0010:ext4_da_release_space+0x25e/0x370 fs/ext4/inode.c:1528
      RSP: 0018:ffffc900015f6c90 EFLAGS: 00010296
      RAX: 42215896cd52ea00 RBX: 0000000000000000 RCX: 42215896cd52ea00
      RDX: 0000000000000000 RSI: 0000000080000001 RDI: 0000000000000000
      RBP: 1ffff1100e907d96 R08: ffffffff816aa79d R09: fffff520002bece5
      R10: fffff520002bece5 R11: 1ffff920002bece4 R12: ffff888021fd2000
      R13: ffff88807483ecb0 R14: 0000000000000001 R15: ffff88807483e740
      FS:  0000000000000000(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00005555569ba628 CR3: 000000000c88e000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
       ext4_es_remove_extent+0x1ab/0x260 fs/ext4/extents_status.c:1461
       mpage_release_unused_pages+0x24d/0xef0 fs/ext4/inode.c:1589
       ext4_writepages+0x12eb/0x3be0 fs/ext4/inode.c:2852
       do_writepages+0x3c3/0x680 mm/page-writeback.c:2469
       __writeback_single_inode+0xd1/0x670 fs/fs-writeback.c:1587
       writeback_sb_inodes+0xb3b/0x18f0 fs/fs-writeback.c:1870
       wb_writeback+0x41f/0x7b0 fs/fs-writeback.c:2044
       wb_do_writeback fs/fs-writeback.c:2187 [inline]
       wb_workfn+0x3cb/0xef0 fs/fs-writeback.c:2227
       process_one_work+0x877/0xdb0 kernel/workqueue.c:2289
       worker_thread+0xb14/0x1330 kernel/workqueue.c:2436
       kthread+0x266/0x300 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
       </TASK>
      
      Above issue may happens as follows:
      ext4_da_write_begin
        ext4_create_inline_data
          ext4_clear_inode_flag(inode, EXT4_INODE_EXTENTS);
          ext4_set_inode_flag(inode, EXT4_INODE_INLINE_DATA);
      __ext4_ioctl
        ext4_ext_migrate -> will lead to eh->eh_entries not zero, and set extent flag
      ext4_da_write_begin
        ext4_da_convert_inline_data_to_extent
          ext4_da_write_inline_data_begin
            ext4_da_map_blocks
              ext4_insert_delayed_block
      	  if (!ext4_es_scan_clu(inode, &ext4_es_is_delonly, lblk))
      	    if (!ext4_es_scan_clu(inode, &ext4_es_is_mapped, lblk))
      	      ext4_clu_mapped(inode, EXT4_B2C(sbi, lblk)); -> will return 1
      	       allocated = true;
                ext4_es_insert_delayed_block(inode, lblk, allocated);
      ext4_writepages
        mpage_map_and_submit_extent(handle, &mpd, &give_up_on_write); -> return -ENOSPC
        mpage_release_unused_pages(&mpd, give_up_on_write); -> give_up_on_write == 1
          ext4_es_remove_extent
            ext4_da_release_space(inode, reserved);
              if (unlikely(to_free > ei->i_reserved_data_blocks))
      	  -> to_free == 1  but ei->i_reserved_data_blocks == 0
      	  -> then trigger warning as above
      
      To solve above issue, forbid inode do migrate which has inline data.
      
      Cc: stable@kernel.org
      Reported-by: default avatar <syzbot+c740bb18df70ad00952e@syzkaller.appspotmail.com>
      Signed-off-by: default avatarYe Bin <yebin10@huawei.com>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Link: https://lore.kernel.org/r/20221018022701.683489-1-yebin10@huawei.com
      
      
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      1b8f787e
    • Luís Henriques's avatar
      ext4: fix BUG_ON() when directory entry has invalid rec_len · 17a0bc9b
      Luís Henriques authored
      The rec_len field in the directory entry has to be a multiple of 4.  A
      corrupted filesystem image can be used to hit a BUG() in
      ext4_rec_len_to_disk(), called from make_indexed_dir().
      
       ------------[ cut here ]------------
       kernel BUG at fs/ext4/ext4.h:2413!
       ...
       RIP: 0010:make_indexed_dir+0x53f/0x5f0
       ...
       Call Trace:
        <TASK>
        ? add_dirent_to_buf+0x1b2/0x200
        ext4_add_entry+0x36e/0x480
        ext4_add_nondir+0x2b/0xc0
        ext4_create+0x163/0x200
        path_openat+0x635/0xe90
        do_filp_open+0xb4/0x160
        ? __create_object.isra.0+0x1de/0x3b0
        ? _raw_spin_unlock+0x12/0x30
        do_sys_openat2+0x91/0x150
        __x64_sys_open+0x6c/0xa0
        do_syscall_64+0x3c/0x80
        entry_SYSCALL_64_after_hwframe+0x46/0xb0
      
      The fix simply adds a call to ext4_check_dir_entry() to validate the
      directory entry, returning -EFSCORRUPTED if the entry is invalid.
      
      CC: stable@kernel.org
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=216540
      
      
      Signed-off-by: default avatarLuís Henriques <lhenriques@suse.de>
      Link: https://lore.kernel.org/r/20221012131330.32456-1-lhenriques@suse.de
      
      
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      17a0bc9b
    • Linus Torvalds's avatar
      Merge tag 'acpi-6.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 2f5065a0
      Linus Torvalds authored
      Pull ACPI fix from Rafael Wysocki:
       "Add StorageD3Enable quirk for Dell Inspiron 16 5625 (Mario
        Limonciello)"
      
      * tag 'acpi-6.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: x86: Add another system to quirk list for forcing StorageD3Enable
      2f5065a0
    • Rafael J. Wysocki's avatar
      Merge branch 'acpi-x86' · 6faf4ce5
      Rafael J. Wysocki authored
      * acpi-x86:
        ACPI: x86: Add another system to quirk list for forcing StorageD3Enable
      6faf4ce5
    • Linus Torvalds's avatar
      Merge tag 'block-6.1-2022-11-05' of git://git.kernel.dk/linux · 4869f575
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
      
       - Fixes for the ublk driver (Ming)
      
       - Fixes for error handling memory leaks (Chen Jun, Chen Zhongjin)
      
       - Explicitly clear the last request in a chain when the plug is
         flushed, as it may have already been issued (Al)
      
      * tag 'block-6.1-2022-11-05' of git://git.kernel.dk/linux:
        block: blk_add_rq_to_plug(): clear stale 'last' after flush
        blk-mq: Fix kmemleak in blk_mq_init_allocated_queue
        block: Fix possible memory leak for rq_wb on add_disk failure
        ublk_drv: add ublk_queue_cmd() for cleanup
        ublk_drv: avoid to touch io_uring cmd in blk_mq io path
        ublk_drv: comment on ublk_driver entry of Kconfig
        ublk_drv: return flag of UBLK_F_URING_CMD_COMP_IN_TASK in case of module
      4869f575
  5. Nov 05, 2022
    • ChenXiaoSong's avatar
      cifs: fix use-after-free on the link name · 542228db
      ChenXiaoSong authored
      xfstests generic/011 reported use-after-free bug as follows:
      
        BUG: KASAN: use-after-free in __d_alloc+0x269/0x859
        Read of size 15 at addr ffff8880078933a0 by task dirstress/952
      
        CPU: 1 PID: 952 Comm: dirstress Not tainted 6.1.0-rc3+ #77
        Call Trace:
         __dump_stack+0x23/0x29
         dump_stack_lvl+0x51/0x73
         print_address_description+0x67/0x27f
         print_report+0x3e/0x5c
         kasan_report+0x7b/0xa8
         kasan_check_range+0x1b2/0x1c1
         memcpy+0x22/0x5d
         __d_alloc+0x269/0x859
         d_alloc+0x45/0x20c
         d_alloc_parallel+0xb2/0x8b2
         lookup_open+0x3b8/0x9f9
         open_last_lookups+0x63d/0xc26
         path_openat+0x11a/0x261
         do_filp_open+0xcc/0x168
         do_sys_openat2+0x13b/0x3f7
         do_sys_open+0x10f/0x146
         __se_sys_creat+0x27/0x2e
         __x64_sys_creat+0x55/0x6a
         do_syscall_64+0x40/0x96
         entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
        Allocated by task 952:
         kasan_save_stack+0x1f/0x42
         kasan_set_track+0x21/0x2a
         kasan_save_alloc_info+0x17/0x1d
         __kasan_kmalloc+0x7e/0x87
         __kmalloc_node_track_caller+0x59/0x155
         kstrndup+0x60/0xe6
         parse_mf_symlink+0x215/0x30b
         check_mf_symlink+0x260/0x36a
         cifs_get_inode_info+0x14e1/0x1690
         cifs_revalidate_dentry_attr+0x70d/0x964
         cifs_revalidate_dentry+0x36/0x62
         cifs_d_revalidate+0x162/0x446
         lookup_open+0x36f/0x9f9
         open_last_lookups+0x63d/0xc26
         path_openat+0x11a/0x261
         do_filp_open+0xcc/0x168
         do_sys_openat2+0x13b/0x3f7
         do_sys_open+0x10f/0x146
         __se_sys_creat+0x27/0x2e
         __x64_sys_creat+0x55/0x6a
         do_syscall_64+0x40/0x96
         entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
        Freed by task 950:
         kasan_save_stack+0x1f/0x42
         kasan_set_track+0x21/0x2a
         kasan_save_free_info+0x1c/0x34
         ____kasan_slab_free+0x1c1/0x1d5
         __kasan_slab_free+0xe/0x13
         __kmem_cache_free+0x29a/0x387
         kfree+0xd3/0x10e
         cifs_fattr_to_inode+0xb6a/0xc8c
         cifs_get_inode_info+0x3cb/0x1690
         cifs_revalidate_dentry_attr+0x70d/0x964
         cifs_revalidate_dentry+0x36/0x62
         cifs_d_revalidate+0x162/0x446
         lookup_open+0x36f/0x9f9
         open_last_lookups+0x63d/0xc26
         path_openat+0x11a/0x261
         do_filp_open+0xcc/0x168
         do_sys_openat2+0x13b/0x3f7
         do_sys_open+0x10f/0x146
         __se_sys_creat+0x27/0x2e
         __x64_sys_creat+0x55/0x6a
         do_syscall_64+0x40/0x96
         entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      When opened a symlink, link name is from 'inode->i_link', but it may be
      reset to a new value when revalidate the dentry. If some processes get the
      link name on the race scenario, then UAF will happen on link name.
      
      Fix this by implementing 'get_link' interface to duplicate the link name.
      
      Fixes: 76894f3e
      
       ("cifs: improve symlink handling for smb2+")
      Signed-off-by: default avatarChenXiaoSong <chenxiaosong2@huawei.com>
      Reviewed-by: default avatarPaulo Alcantara (SUSE) <pc@cjr.nz>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      542228db
    • Shyam Prasad N's avatar
      cifs: avoid unnecessary iteration of tcp sessions · 23d9b9b7
      Shyam Prasad N authored
      
      
      In a few places, we do unnecessary iterations of
      tcp sessions, even when the server struct is provided.
      
      The change avoids it and uses the server struct provided.
      
      Signed-off-by: default avatarShyam Prasad N <sprasad@microsoft.com>
      Reviewed-by: default avatarPaulo Alcantara (SUSE) <pc@cjr.nz>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      23d9b9b7
    • Shyam Prasad N's avatar
      cifs: always iterate smb sessions using primary channel · 8abcaeae
      Shyam Prasad N authored
      
      
      smb sessions and tcons currently hang off primary channel only.
      Secondary channels have the lists as empty. Whenever there's a
      need to iterate sessions or tcons, we should use the list in the
      corresponding primary channel.
      
      Signed-off-by: default avatarShyam Prasad N <sprasad@microsoft.com>
      Reviewed-by: default avatarPaulo Alcantara (SUSE) <pc@cjr.nz>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      8abcaeae
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · b208b9fb
      Linus Torvalds authored
      Pull arm64 fixes from Catalin Marinas:
      
       - Avoid kprobe recursion when cortex_a76_erratum_1463225_debug_handler()
         is not inlined (change to __always_inline).
      
       - Fix the visibility of compat hwcaps, broken by recent changes to
         consolidate the visibility of hwcaps and the user-space view of the
         ID registers.
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64: cpufeature: Fix the visibility of compat hwcaps
        arm64: entry: avoid kprobe recursion
      b208b9fb
    • Linus Torvalds's avatar
      Merge tag 'i2c-for-6.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 74f3f1d7
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "A documentation fix and driver fixes for piix4, tegra, and i801"
      
      * tag 'i2c-for-6.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        Documentation: devres: add missing I2C helper
        i2c: i801: add lis3lv02d's I2C address for Vostro 5568
        i2c: tegra: Allocate DMA memory for DMA engine
        i2c: piix4: Fix adapter not be removed in piix4_remove()
      74f3f1d7
    • Guenter Roeck's avatar
      Revert "hwmon: (pmbus) Add regulator supply into macro" · 1e699e17
      Guenter Roeck authored
      This reverts commit 54cc3dbf.
      
      Zev Weiss reports that the reverted patch may cause a regulator
      undercount. Here is his report:
      
      ... having regulator-dummy set as a supply on my PMBus regulators
      (instead of having them as their own top-level regulators without
      an upstream supply) leads to enable-count underflow errors when
      disabling them:
      
          # echo 0 > /sys/bus/platform/devices/efuse01/state
          [  906.094477] regulator-dummy: Underflow of regulator enable count
          [  906.100563] Failed to disable vout: -EINVAL
          [  136.992676] reg-userspace-consumer efuse01: Failed to configure state: -22
      
      Zev reports that reverting the patch fixes the problem. So let's do that
      for now.
      
      Fixes: 54cc3dbf
      
       ("hwmon: (pmbus) Add regulator supply into macro")
      Cc: Marcello Sylvester Bauer <sylv@sylv.io>
      Reported-by: default avatarZev Weiss <zev@bewilderbeest.net>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      1e699e17
    • Cristian Marussi's avatar
      hwmon: (scmi) Register explicitly with Thermal Framework · c4f68373
      Cristian Marussi authored
      
      
      Available sensors are enumerated and reported by the SCMI platform server
      using a 16bit identification number; not all such sensors are of a type
      supported by hwmon subsystem and, among the supported ones, only a subset
      could be temperature sensors that have to be registered with the Thermal
      Framework.
      Potential clashes between hwmon channels indexes and the underlying real
      sensors IDs do not play well with the hwmon<-->thermal bridge automatic
      registration routines and could need a sensible number of fake dummy
      sensors to be made up in order to keep indexes and IDs in sync.
      
      Avoid to use the hwmon<-->thermal bridge dropping the HWMON_C_REGISTER_TZ
      attribute and instead explicit register temperature sensors directly with
      the Thermal Framework.
      
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: linux-hwmon@vger.kernel.org
      Signed-off-by: default avatarCristian Marussi <cristian.marussi@arm.com>
      Acked-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Link: https://lore.kernel.org/r/20221031114018.59048-1-cristian.marussi@arm.com
      
      
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      c4f68373