Skip to content
Snippets Groups Projects
  1. Mar 01, 2024
    • Baokun Li's avatar
      ext4: avoid allocating blocks from corrupted group in ext4_mb_try_best_found() · 927794a0
      Baokun Li authored
      
      [ Upstream commit 4530b366 ]
      
      Determine if the group block bitmap is corrupted before using ac_b_ex in
      ext4_mb_try_best_found() to avoid allocating blocks from a group with a
      corrupted block bitmap in the following concurrency and making the
      situation worse.
      
      ext4_mb_regular_allocator
        ext4_lock_group(sb, group)
        ext4_mb_good_group
         // check if the group bbitmap is corrupted
        ext4_mb_complex_scan_group
         // Scan group gets ac_b_ex but doesn't use it
        ext4_unlock_group(sb, group)
                                 ext4_mark_group_bitmap_corrupted(group)
                                 // The block bitmap was corrupted during
                                 // the group unlock gap.
        ext4_mb_try_best_found
          ext4_lock_group(ac->ac_sb, group)
          ext4_mb_use_best_found
            mb_mark_used
            // Allocating blocks in block bitmap corrupted group
      
      Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Link: https://lore.kernel.org/r/20240104142040.2835097-7-libaokun1@huawei.com
      
      
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      927794a0
    • Lennert Buytenhek's avatar
      ahci: add 43-bit DMA address quirk for ASMedia ASM1061 controllers · 2b39c1a0
      Lennert Buytenhek authored
      [ Upstream commit 20730e9b ]
      
      With one of the on-board ASM1061 AHCI controllers (1b21:0612) on an
      ASUSTeK Pro WS WRX80E-SAGE SE WIFI mainboard, a controller hang was
      observed that was immediately preceded by the following kernel
      messages:
      
      ahci 0000:28:00.0: Using 64-bit DMA addresses
      ahci 0000:28:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0035 address=0x7fffff00000 flags=0x0000]
      ahci 0000:28:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0035 address=0x7fffff00300 flags=0x0000]
      ahci 0000:28:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0035 address=0x7fffff00380 flags=0x0000]
      ahci 0000:28:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0035 address=0x7fffff00400 flags=0x0000]
      ahci 0000:28:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0035 address=0x7fffff00680 flags=0x0000]
      ahci 0000:28:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0035 address=0x7fffff00700 flags=0x0000]
      
      The first message is produced by code in drivers/iommu/dma-iommu.c
      which is accompanied by the following comment that seems to apply:
      
              /*
               * Try to use all the 32-bit PCI addresses first. The original SAC vs.
               * DAC reasoning loses relevance with PCIe, but enough hardware and
               * firmware bugs are still lurking out there that it's safest not to
               * venture into the 64-bit space until necessary.
               *
               * If your device goes wrong after seeing the notice then likely either
               * its driver is not setting DMA masks accurately, the hardware has
               * some inherent bug in handling >32-bit addresses, or not all the
               * expected address bits are wired up between the device and the IOMMU.
               */
      
      Asking the ASM1061 on a discrete PCIe card to DMA from I/O virtual
      address 0xffffffff00000000 produces the following I/O page faults:
      
      vfio-pci 0000:07:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0021 address=0x7ff00000000 flags=0x0010]
      vfio-pci 0000:07:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0021 address=0x7ff00000500 flags=0x0010]
      
      Note that the upper 21 bits of the logged DMA address are zero.  (When
      asking a different PCIe device in the same PCIe slot to DMA to the
      same I/O virtual address, we do see all the upper 32 bits of the DMA
      address as 1, so this is not an issue with the chipset or IOMMU
      configuration on the test system.)
      
      Also, hacking libahci to always set the upper 21 bits of all DMA
      addresses to 1 produces no discernible effect on the behavior of the
      ASM1061, and mkfs/mount/scrub/etc work as without this hack.
      
      This all strongly suggests that the ASM1061 has a 43 bit DMA address
      limit, and this commit therefore adds a quirk to deal with this limit.
      
      This issue probably applies to (some of) the other supported ASMedia
      parts as well, but we limit it to the PCI IDs known to refer to
      ASM1061 parts, as that's the only part we know for sure to be affected
      by this issue at this point.
      
      Link: https://lore.kernel.org/linux-ide/ZaZ2PIpEId-rl6jv@wantstofly.org/
      
      
      Signed-off-by: default avatarLennert Buytenhek <kernel@wantstofly.org>
      [cassel: drop date from error messages in commit log]
      Signed-off-by: default avatarNiklas Cassel <cassel@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2b39c1a0
    • Conrad Kostecki's avatar
      ahci: asm1166: correct count of reported ports · 15bb22da
      Conrad Kostecki authored
      [ Upstream commit 0077a504 ]
      
      The ASM1166 SATA host controller always reports wrongly,
      that it has 32 ports. But in reality, it only has six ports.
      
      This seems to be a hardware issue, as all tested ASM1166
      SATA host controllers reports such high count of ports.
      
      Example output: ahci 0000:09:00.0: AHCI 0001.0301
      32 slots 32 ports 6 Gbps 0xffffff3f impl SATA mode.
      
      By adjusting the port_map, the count is limited to six ports.
      
      New output: ahci 0000:09:00.0: AHCI 0001.0301
      32 slots 32 ports 6 Gbps 0x3f impl SATA mode.
      
      Closes: https://bugzilla.kernel.org/show_bug.cgi?id=211873
      Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218346
      
      
      Signed-off-by: default avatarConrad Kostecki <conikost@gentoo.org>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarNiklas Cassel <cassel@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      15bb22da
    • Devyn Liu's avatar
      spi: hisi-sfc-v3xx: Return IRQ_NONE if no interrupts were detected · e94da8ac
      Devyn Liu authored
      
      [ Upstream commit de8b6e1c ]
      
      Return IRQ_NONE from the interrupt handler when no interrupt was
      detected. Because an empty interrupt will cause a null pointer error:
      
          Unable to handle kernel NULL pointer dereference at virtual
        address 0000000000000008
          Call trace:
              complete+0x54/0x100
              hisi_sfc_v3xx_isr+0x2c/0x40 [spi_hisi_sfc_v3xx]
              __handle_irq_event_percpu+0x64/0x1e0
              handle_irq_event+0x7c/0x1cc
      
      Signed-off-by: default avatarDevyn Liu <liudingyuan@huawei.com>
      Link: https://msgid.link/r/20240123071149.917678-1-liudingyuan@huawei.com
      
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e94da8ac
    • Fullway Wang's avatar
      fbdev: sis: Error out if pixclock equals zero · cd36da76
      Fullway Wang authored
      
      [ Upstream commit e421946b ]
      
      The userspace program could pass any values to the driver through
      ioctl() interface. If the driver doesn't check the value of pixclock,
      it may cause divide-by-zero error.
      
      In sisfb_check_var(), var->pixclock is used as a divisor to caculate
      drate before it is checked against zero. Fix this by checking it
      at the beginning.
      
      This is similar to CVE-2022-3061 in i740fb which was fixed by
      commit 15cf0b82.
      
      Signed-off-by: default avatarFullway Wang <fullwaywang@outlook.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cd36da76
    • Fullway Wang's avatar
      fbdev: savage: Error out if pixclock equals zero · 512ee6d6
      Fullway Wang authored
      
      [ Upstream commit 04e5eac8 ]
      
      The userspace program could pass any values to the driver through
      ioctl() interface. If the driver doesn't check the value of pixclock,
      it may cause divide-by-zero error.
      
      Although pixclock is checked in savagefb_decode_var(), but it is not
      checked properly in savagefb_probe(). Fix this by checking whether
      pixclock is zero in the function savagefb_check_var() before
      info->var.pixclock is used as the divisor.
      
      This is similar to CVE-2022-3061 in i740fb which was fixed by
      commit 15cf0b82.
      
      Signed-off-by: default avatarFullway Wang <fullwaywang@outlook.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      512ee6d6
    • Felix Fietkau's avatar
      wifi: mac80211: fix race condition on enabling fast-xmit · 5ffab99e
      Felix Fietkau authored
      
      [ Upstream commit bcbc84af ]
      
      fast-xmit must only be enabled after the sta has been uploaded to the driver,
      otherwise it could end up passing the not-yet-uploaded sta via drv_tx calls
      to the driver, leading to potential crashes because of uninitialized drv_priv
      data.
      Add a missing sta->uploaded check and re-check fast xmit after inserting a sta.
      
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      Link: https://msgid.link/20240104181059.84032-1-nbd@nbd.name
      
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5ffab99e
    • Michal Kazior's avatar
      wifi: cfg80211: fix missing interfaces when dumping · 7e71fbc6
      Michal Kazior authored
      
      [ Upstream commit a6e4f85d ]
      
      The nl80211_dump_interface() supports resumption
      in case nl80211_send_iface() doesn't have the
      resources to complete its work.
      
      The logic would store the progress as iteration
      offsets for rdev and wdev loops.
      
      However the logic did not properly handle
      resumption for non-last rdev. Assuming a system
      with 2 rdevs, with 2 wdevs each, this could
      happen:
      
       dump(cb=[0, 0]):
        if_start=cb[1] (=0)
        send rdev0.wdev0 -> ok
        send rdev0.wdev1 -> yield
        cb[1] = 1
      
       dump(cb=[0, 1]):
        if_start=cb[1] (=1)
        send rdev0.wdev1 -> ok
        // since if_start=1 the rdev0.wdev0 got skipped
        // through if_idx < if_start
        send rdev1.wdev1 -> ok
      
      The if_start needs to be reset back to 0 upon wdev
      loop end.
      
      The problem is actually hard to hit on a desktop,
      and even on most routers. The prerequisites for
      this manifesting was:
       - more than 1 wiphy
       - a few handful of interfaces
       - dump without rdev or wdev filter
      
      I was seeing this with 4 wiphys 9 interfaces each.
      It'd miss 6 interfaces from the last wiphy
      reported to userspace.
      
      Signed-off-by: default avatarMichal Kazior <michal@plume.com>
      Link: https://msgid.link/20240116142340.89678-1-kazikcz@gmail.com
      
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7e71fbc6
    • Vinod Koul's avatar
      dmaengine: fsl-qdma: increase size of 'irq_name' · 17c976fe
      Vinod Koul authored
      
      [ Upstream commit 6386f6c9 ]
      
      We seem to have hit warnings of 'output may be truncated' which is fixed
      by increasing the size of 'irq_name'
      
      drivers/dma/fsl-qdma.c: In function ‘fsl_qdma_irq_init’:
      drivers/dma/fsl-qdma.c:824:46: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Werror=format-overflow=]
        824 |                 sprintf(irq_name, "qdma-queue%d", i);
            |                                              ^~
      drivers/dma/fsl-qdma.c:824:35: note: directive argument in the range [-2147483641, 2147483646]
        824 |                 sprintf(irq_name, "qdma-queue%d", i);
            |                                   ^~~~~~~~~~~~~~
      drivers/dma/fsl-qdma.c:824:17: note: ‘sprintf’ output between 12 and 22 bytes into a destination of size 20
        824 |                 sprintf(irq_name, "qdma-queue%d", i);
            |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      17c976fe
    • Vinod Koul's avatar
      dmaengine: shdma: increase size of 'dev_id' · d94a80da
      Vinod Koul authored
      
      [ Upstream commit 40429024 ]
      
      We seem to have hit warnings of 'output may be truncated' which is fixed
      by increasing the size of 'dev_id'
      
      drivers/dma/sh/shdmac.c: In function ‘sh_dmae_probe’:
      drivers/dma/sh/shdmac.c:541:34: error: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 9 [-Werror=format-truncation=]
        541 |                          "sh-dmae%d.%d", pdev->id, id);
            |                                  ^~
      In function ‘sh_dmae_chan_probe’,
          inlined from ‘sh_dmae_probe’ at drivers/dma/sh/shdmac.c:845:9:
      drivers/dma/sh/shdmac.c:541:26: note: directive argument in the range [0, 2147483647]
        541 |                          "sh-dmae%d.%d", pdev->id, id);
            |                          ^~~~~~~~~~~~~~
      drivers/dma/sh/shdmac.c:541:26: note: directive argument in the range [0, 19]
      drivers/dma/sh/shdmac.c:540:17: note: ‘snprintf’ output between 11 and 21 bytes into a destination of size 16
        540 |                 snprintf(sh_chan->dev_id, sizeof(sh_chan->dev_id),
            |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        541 |                          "sh-dmae%d.%d", pdev->id, id);
            |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d94a80da
    • Dmitry Bogdanov's avatar
      scsi: target: core: Add TMF to tmr_list handling · 168ed591
      Dmitry Bogdanov authored
      
      [ Upstream commit 83ab6816 ]
      
      An abort that is responded to by iSCSI itself is added to tmr_list but does
      not go to target core. A LUN_RESET that goes through tmr_list takes a
      refcounter on the abort and waits for completion. However, the abort will
      be never complete because it was not started in target core.
      
       Unable to locate ITT: 0x05000000 on CID: 0
       Unable to locate RefTaskTag: 0x05000000 on CID: 0.
       wait_for_tasks: Stopping tmf LUN_RESET with tag 0x0 ref_task_tag 0x0 i_state 34 t_state ISTATE_PROCESSING refcnt 2 transport_state active,stop,fabric_stop
       wait for tasks: tmf LUN_RESET with tag 0x0 ref_task_tag 0x0 i_state 34 t_state ISTATE_PROCESSING refcnt 2 transport_state active,stop,fabric_stop
      ...
       INFO: task kworker/0:2:49 blocked for more than 491 seconds.
       task:kworker/0:2     state:D stack:    0 pid:   49 ppid:     2 flags:0x00000800
       Workqueue: events target_tmr_work [target_core_mod]
      Call Trace:
       __switch_to+0x2c4/0x470
       _schedule+0x314/0x1730
       schedule+0x64/0x130
       schedule_timeout+0x168/0x430
       wait_for_completion+0x140/0x270
       target_put_cmd_and_wait+0x64/0xb0 [target_core_mod]
       core_tmr_lun_reset+0x30/0xa0 [target_core_mod]
       target_tmr_work+0xc8/0x1b0 [target_core_mod]
       process_one_work+0x2d4/0x5d0
       worker_thread+0x78/0x6c0
      
      To fix this, only add abort to tmr_list if it will be handled by target
      core.
      
      Signed-off-by: default avatarDmitry Bogdanov <d.bogdanov@yadro.com>
      Link: https://lore.kernel.org/r/20240111125941.8688-1-d.bogdanov@yadro.com
      
      
      Reviewed-by: default avatarMike Christie <michael.christie@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      168ed591
    • Cyril Hrubis's avatar
      sched/rt: Disallow writing invalid values to sched_rt_period_us · e4bc3117
      Cyril Hrubis authored
      commit 079be8fc upstream.
      
      The validation of the value written to sched_rt_period_us was broken
      because:
      
        - the sysclt_sched_rt_period is declared as unsigned int
        - parsed by proc_do_intvec()
        - the range is asserted after the value parsed by proc_do_intvec()
      
      Because of this negative values written to the file were written into a
      unsigned integer that were later on interpreted as large positive
      integers which did passed the check:
      
        if (sysclt_sched_rt_period <= 0)
      	return EINVAL;
      
      This commit fixes the parsing by setting explicit range for both
      perid_us and runtime_us into the sched_rt_sysctls table and processes
      the values with proc_dointvec_minmax() instead.
      
      Alternatively if we wanted to use full range of unsigned int for the
      period value we would have to split the proc_handler and use
      proc_douintvec() for it however even the
      Documentation/scheduller/sched-rt-group.rst describes the range as 1 to
      INT_MAX.
      
      As far as I can tell the only problem this causes is that the sysctl
      file allows writing negative values which when read back may confuse
      userspace.
      
      There is also a LTP test being submitted for these sysctl files at:
      
        http://patchwork.ozlabs.org/project/ltp/patch/20230901144433.2526-1-chrubis@suse.cz/
      
      
      
      Signed-off-by: default avatarCyril Hrubis <chrubis@suse.cz>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20231002115553.3007-2-chrubis@suse.cz
      
      
      [ pvorel: rebased for 5.15, 5.10 ]
      Reviewed-by: default avatarPetr Vorel <pvorel@suse.cz>
      Signed-off-by: default avatarPetr Vorel <pvorel@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e4bc3117
    • Cyril Hrubis's avatar
      sched/rt: Fix sysctl_sched_rr_timeslice intial value · 13c6bce7
      Cyril Hrubis authored
      
      commit c7fcb998 upstream.
      
      There is a 10% rounding error in the intial value of the
      sysctl_sched_rr_timeslice with CONFIG_HZ_300=y.
      
      This was found with LTP test sched_rr_get_interval01:
      
      sched_rr_get_interval01.c:57: TPASS: sched_rr_get_interval() passed
      sched_rr_get_interval01.c:64: TPASS: Time quantum 0s 99999990ns
      sched_rr_get_interval01.c:72: TFAIL: /proc/sys/kernel/sched_rr_timeslice_ms != 100 got 90
      sched_rr_get_interval01.c:57: TPASS: sched_rr_get_interval() passed
      sched_rr_get_interval01.c:64: TPASS: Time quantum 0s 99999990ns
      sched_rr_get_interval01.c:72: TFAIL: /proc/sys/kernel/sched_rr_timeslice_ms != 100 got 90
      
      What this test does is to compare the return value from the
      sched_rr_get_interval() and the sched_rr_timeslice_ms sysctl file and
      fails if they do not match.
      
      The problem it found is the intial sysctl file value which was computed as:
      
      static int sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE;
      
      which works fine as long as MSEC_PER_SEC is multiple of HZ, however it
      introduces 10% rounding error for CONFIG_HZ_300:
      
      (MSEC_PER_SEC / HZ) * (100 * HZ / 1000)
      
      (1000 / 300) * (100 * 300 / 1000)
      
      3 * 30 = 90
      
      This can be easily fixed by reversing the order of the multiplication
      and division. After this fix we get:
      
      (MSEC_PER_SEC * (100 * HZ / 1000)) / HZ
      
      (1000 * (100 * 300 / 1000)) / 300
      
      (1000 * 30) / 300 = 100
      
      Fixes: 975e155e ("sched/rt: Show the 'sched_rr_timeslice' SCHED_RR timeslice tuning knob in milliseconds")
      Signed-off-by: default avatarCyril Hrubis <chrubis@suse.cz>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: default avatarPetr Vorel <pvorel@suse.cz>
      Acked-by: default avatarMel Gorman <mgorman@suse.de>
      Tested-by: default avatarPetr Vorel <pvorel@suse.cz>
      Link: https://lore.kernel.org/r/20230802151906.25258-2-chrubis@suse.cz
      
      
      [ pvorel: rebased for 5.15, 5.10 ]
      Signed-off-by: default avatarPetr Vorel <pvorel@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      13c6bce7
    • Damien Le Moal's avatar
      zonefs: Improve error handling · b1ba0651
      Damien Le Moal authored
      
      commit 14db5f64 upstream.
      
      Write error handling is racy and can sometime lead to the error recovery
      path wrongly changing the inode size of a sequential zone file to an
      incorrect value  which results in garbage data being readable at the end
      of a file. There are 2 problems:
      
      1) zonefs_file_dio_write() updates a zone file write pointer offset
         after issuing a direct IO with iomap_dio_rw(). This update is done
         only if the IO succeed for synchronous direct writes. However, for
         asynchronous direct writes, the update is done without waiting for
         the IO completion so that the next asynchronous IO can be
         immediately issued. However, if an asynchronous IO completes with a
         failure right before the i_truncate_mutex lock protecting the update,
         the update may change the value of the inode write pointer offset
         that was corrected by the error path (zonefs_io_error() function).
      
      2) zonefs_io_error() is called when a read or write error occurs. This
         function executes a report zone operation using the callback function
         zonefs_io_error_cb(), which does all the error recovery handling
         based on the current zone condition, write pointer position and
         according to the mount options being used. However, depending on the
         zoned device being used, a report zone callback may be executed in a
         context that is different from the context of __zonefs_io_error(). As
         a result, zonefs_io_error_cb() may be executed without the inode
         truncate mutex lock held, which can lead to invalid error processing.
      
      Fix both problems as follows:
      - Problem 1: Perform the inode write pointer offset update before a
        direct write is issued with iomap_dio_rw(). This is safe to do as
        partial direct writes are not supported (IOMAP_DIO_PARTIAL is not
        set) and any failed IO will trigger the execution of zonefs_io_error()
        which will correct the inode write pointer offset to reflect the
        current state of the one on the device.
      - Problem 2: Change zonefs_io_error_cb() into zonefs_handle_io_error()
        and call this function directly from __zonefs_io_error() after
        obtaining the zone information using blkdev_report_zones() with a
        simple callback function that copies to a local stack variable the
        struct blk_zone obtained from the device. This ensures that error
        handling is performed holding the inode truncate mutex.
        This change also simplifies error handling for conventional zone files
        by bypassing the execution of report zones entirely. This is safe to
        do because the condition of conventional zones cannot be read-only or
        offline and conventional zone files are always fully mapped with a
        constant file size.
      
      Reported-by: default avatarShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
      Fixes: 8dcc1a9d ("fs: New zonefs file system")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Tested-by: default avatarShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b1ba0651
    • Lokesh Gidra's avatar
      userfaultfd: fix mmap_changing checking in mfill_atomic_hugetlb · 19087d70
      Lokesh Gidra authored
      commit 67695f18 upstream.
      
      In mfill_atomic_hugetlb(), mmap_changing isn't being checked
      again if we drop mmap_lock and reacquire it. When the lock is not held,
      mmap_changing could have been incremented. This is also inconsistent
      with the behavior in mfill_atomic().
      
      Link: https://lkml.kernel.org/r/20240117223729.1444522-1-lokeshgidra@google.com
      
      
      Fixes: df2cc96e ("userfaultfd: prevent non-cooperative events vs mcopy_atomic races")
      Signed-off-by: default avatarLokesh Gidra <lokeshgidra@google.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: Axel Rasmussen <axelrasmussen@google.com>
      Cc: Brian Geffon <bgeffon@google.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Kalesh Singh <kaleshsingh@google.com>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Nicolas Geoffray <ngeoffray@google.com>
      Cc: Peter Xu <peterx@redhat.com>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarMike Rapoport (IBM) <rppt@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      19087d70
    • Cyril Hrubis's avatar
      sched/rt: sysctl_sched_rr_timeslice show default timeslice after reset · 18d88bf9
      Cyril Hrubis authored
      
      commit c1fc6484 upstream.
      
      The sched_rr_timeslice can be reset to default by writing value that is
      <= 0. However after reading from this file we always got the last value
      written, which is not useful at all.
      
      $ echo -1 > /proc/sys/kernel/sched_rr_timeslice_ms
      $ cat /proc/sys/kernel/sched_rr_timeslice_ms
      -1
      
      Fix this by setting the variable that holds the sysctl file value to the
      jiffies_to_msecs(RR_TIMESLICE) in case that <= 0 value was written.
      
      Signed-off-by: default avatarCyril Hrubis <chrubis@suse.cz>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: default avatarPetr Vorel <pvorel@suse.cz>
      Acked-by: default avatarMel Gorman <mgorman@suse.de>
      Tested-by: default avatarPetr Vorel <pvorel@suse.cz>
      Cc: Mahmoud Adam <mngyadam@amazon.com>
      Link: https://lore.kernel.org/r/20230802151906.25258-3-chrubis@suse.cz
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      18d88bf9
    • Paulo Alcantara's avatar
      smb: client: fix parsing of SMB3.1.1 POSIX create context · 94b06498
      Paulo Alcantara authored
      
      [ Upstream commit 76025cc2 ]
      
      The data offset for the SMB3.1.1 POSIX create context will always be
      8-byte aligned so having the check 'noff + nlen >= doff' in
      smb2_parse_contexts() is wrong as it will lead to -EINVAL because noff
      + nlen == doff.
      
      Fix the sanity check to correctly handle aligned create context data.
      
      Fixes: af1689a9 ("smb: client: fix potential OOBs in smb2_parse_contexts()")
      Signed-off-by: default avatarPaulo Alcantara <pc@manguebit.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      [Guru:smb2_parse_contexts()  is present in file smb2ops.c,
      smb2ops.c file location is changed, modified patch accordingly.]
      Signed-off-by: default avatarGuruswamy Basavaiah <guruswamy.basavaiah@broadcom.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      94b06498
    • Paulo Alcantara's avatar
      smb: client: fix potential OOBs in smb2_parse_contexts() · 13fb0fc4
      Paulo Alcantara authored
      
      [ Upstream commit af1689a9 ]
      
      Validate offsets and lengths before dereferencing create contexts in
      smb2_parse_contexts().
      
      This fixes following oops when accessing invalid create contexts from
      server:
      
        BUG: unable to handle page fault for address: ffff8881178d8cc3
        #PF: supervisor read access in kernel mode
        #PF: error_code(0x0000) - not-present page
        PGD 4a01067 P4D 4a01067 PUD 0
        Oops: 0000 [#1] PREEMPT SMP NOPTI
        CPU: 3 PID: 1736 Comm: mount.cifs Not tainted 6.7.0-rc4 #1
        Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
        rel-1.16.2-3-gd478f380-rebuilt.opensuse.org 04/01/2014
        RIP: 0010:smb2_parse_contexts+0xa0/0x3a0 [cifs]
        Code: f8 10 75 13 48 b8 93 ad 25 50 9c b4 11 e7 49 39 06 0f 84 d2 00
        00 00 8b 45 00 85 c0 74 61 41 29 c5 48 01 c5 41 83 fd 0f 76 55 <0f> b7
        7d 04 0f b7 45 06 4c 8d 74 3d 00 66 83 f8 04 75 bc ba 04 00
        RSP: 0018:ffffc900007939e0 EFLAGS: 00010216
        RAX: ffffc90000793c78 RBX: ffff8880180cc000 RCX: ffffc90000793c90
        RDX: ffffc90000793cc0 RSI: ffff8880178d8cc0 RDI: ffff8880180cc000
        RBP: ffff8881178d8cbf R08: ffffc90000793c22 R09: 0000000000000000
        R10: ffff8880180cc000 R11: 0000000000000024 R12: 0000000000000000
        R13: 0000000000000020 R14: 0000000000000000 R15: ffffc90000793c22
        FS: 00007f873753cbc0(0000) GS:ffff88806bc00000(0000)
        knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: ffff8881178d8cc3 CR3: 00000000181ca000 CR4: 0000000000750ef0
        PKRU: 55555554
        Call Trace:
         <TASK>
         ? __die+0x23/0x70
         ? page_fault_oops+0x181/0x480
         ? search_module_extables+0x19/0x60
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? exc_page_fault+0x1b6/0x1c0
         ? asm_exc_page_fault+0x26/0x30
         ? smb2_parse_contexts+0xa0/0x3a0 [cifs]
         SMB2_open+0x38d/0x5f0 [cifs]
         ? smb2_is_path_accessible+0x138/0x260 [cifs]
         smb2_is_path_accessible+0x138/0x260 [cifs]
         cifs_is_path_remote+0x8d/0x230 [cifs]
         cifs_mount+0x7e/0x350 [cifs]
         cifs_smb3_do_mount+0x128/0x780 [cifs]
         smb3_get_tree+0xd9/0x290 [cifs]
         vfs_get_tree+0x2c/0x100
         ? capable+0x37/0x70
         path_mount+0x2d7/0xb80
         ? srso_alias_return_thunk+0x5/0xfbef5
         ? _raw_spin_unlock_irqrestore+0x44/0x60
         __x64_sys_mount+0x11a/0x150
         do_syscall_64+0x47/0xf0
         entry_SYSCALL_64_after_hwframe+0x6f/0x77
        RIP: 0033:0x7f8737657b1e
      
      Reported-by: default avatarRobert Morris <rtm@csail.mit.edu>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      [Guru: Removed changes to cached_dir.c and checking return value
      of smb2_parse_contexts in smb2ops.c]
      Signed-off-by: default avatarGuruswamy Basavaiah <guruswamy.basavaiah@broadcom.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      13fb0fc4
    • Paulo Alcantara's avatar
      smb: client: fix OOB in receive_encrypted_standard() · b03c8099
      Paulo Alcantara authored
      
      [ Upstream commit eec04ea1 ]
      
      Fix potential OOB in receive_encrypted_standard() if server returned a
      large shdr->NextCommand that would end up writing off the end of
      @next_buffer.
      
      Fixes: b24df3e3 ("cifs: update receive_encrypted_standard to handle compounded responses")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarRobert Morris <rtm@csail.mit.edu>
      Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      [Guru: receive_encrypted_standard() is present in file smb2ops.c,
      smb2ops.c file location is changed, modified patch accordingly.]
      Signed-off-by: default avatarGuruswamy Basavaiah <guruswamy.basavaiah@broadcom.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b03c8099
    • Jamal Hadi Salim's avatar
      net/sched: Retire dsmark qdisc · 3fa31e7a
      Jamal Hadi Salim authored
      
      commit bbe77c14 upstream.
      
      The dsmark qdisc has served us well over the years for diffserv but has not
      been getting much attention due to other more popular approaches to do diffserv
      services. Most recently it has become a shooting target for syzkaller. For this
      reason, we are retiring it.
      
      Signed-off-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Acked-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3fa31e7a
    • Jamal Hadi Salim's avatar
      net/sched: Retire ATM qdisc · 71925d68
      Jamal Hadi Salim authored
      
      commit fb38306c upstream.
      
      The ATM qdisc has served us well over the years but has not been getting much
      TLC due to lack of known users. Most recently it has become a shooting target
      for syzkaller. For this reason, we are retiring it.
      
      Signed-off-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Acked-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      71925d68
    • Jamal Hadi Salim's avatar
      net/sched: Retire CBQ qdisc · 56a6720d
      Jamal Hadi Salim authored
      
      commit 051d4420 upstream.
      
      While this amazing qdisc has served us well over the years it has not been
      getting any tender love and care and has bitrotted over time.
      It has become mostly a shooting target for syzkaller lately.
      For this reason, we are retiring it. Goodbye CBQ - we loved you.
      
      Signed-off-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Acked-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      56a6720d
  2. Feb 23, 2024
Loading