1. 17 Jun, 2022 12 commits
  2. 16 Jun, 2022 10 commits
    • Mikulas Patocka's avatar
      dm mirror log: round up region bitmap size to BITS_PER_LONG · 85e123c2
      Mikulas Patocka authored
      The code in dm-log rounds up bitset_size to 32 bits. It then uses
      find_next_zero_bit_le on the allocated region. find_next_zero_bit_le
      accesses the bitmap using unsigned long pointers. So, on 64-bit
      architectures, it may access 4 bytes beyond the allocated size.
      
      Fix this bug by rounding up bitset_size to BITS_PER_LONG.
      
      This bug was found by running the lvm2 testsuite with kasan.
      
      Fixes: 29121bd0 ("[PATCH] dm mirror log: bitset_size fix")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
      85e123c2
    • Mikulas Patocka's avatar
      dm: fix narrow race for REQ_NOWAIT bios being issued despite no support · 1ee88de3
      Mikulas Patocka authored
      Starting with the commit 63a225c9fd20, device mapper has an optimization
      that it will take cheaper table lock (dm_get_live_table_fast instead of
      dm_get_live_table) if the bio has REQ_NOWAIT. The bios with REQ_NOWAIT
      must not block in the target request routine, if they did, we would be
      blocking while holding rcu_read_lock, which is prohibited.
      
      The targets that are suitable for REQ_NOWAIT optimization (and that don't
      block in the map routine) have the flag DM_TARGET_NOWAIT set. Device
      mapper will test if all the targets and all the devices in a table
      support nowait (see the function dm_table_supports_nowait) and it will set
      or clear the QUEUE_FLAG_NOWAIT flag on its request queue according to
      this check.
      
      There's a test in submit_bio_noacct: "if ((bio->bi_opf & REQ_NOWAIT) &&
      !blk_queue_nowait(q)) goto not_supported" - this will make sure that
      REQ_NOWAIT bios can't enter a request queue that doesn't support them.
      
      This mechanism works to prevent REQ_NOWAIT bios from reaching dm targets
      that don't support the REQ_NOWAIT flag (and that may block in the map
      routine) - except that there is a small race condition:
      
      submit_bio_noacct checks if the queue has the QUEUE_FLAG_NOWAIT without
      holding any locks. Immediatelly after this check, the device mapper table
      may be reloaded with a table that doesn't support REQ_NOWAIT (for example,
      if we start moving the logical volume or if we activate a snapshot).
      However the REQ_NOWAIT bio that already passed the check in
      submit_bio_noacct would be sent to device mapper, where it could be
      redirected to a dm target that doesn't support REQ_NOWAIT - the result is
      sleeping while we hold rcu_read_lock.
      
      In order to fix this race, we double-check if the target supports
      REQ_NOWAIT while we hold the table lock (so that the table can't change
      under us).
      
      Fixes: 563a225c ("dm: introduce dm_{get,put}_live_table_bio called from dm_submit_bio")
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
      1ee88de3
    • Mikulas Patocka's avatar
      dm: fix use-after-free in dm_put_live_table_bio · 5d7362d0
      Mikulas Patocka authored
      dm_put_live_table_bio is called from the end of dm_submit_bio.
      However, at this point, the bio may be already finished and the caller
      may have freed the bio. Consequently, dm_put_live_table_bio accesses
      the stale "bio" pointer.
      
      Fix this bug by loading the bi_opf value and passing it to
      dm_get_live_table_bio and dm_put_live_table_bio instead of the bio.
      
      This bug was found by running the lvm2 testsuite with kasan.
      
      Fixes: 563a225c ("dm: introduce dm_{get,put}_live_table_bio called from dm_submit_bio")
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
      5d7362d0
    • Dave Airlie's avatar
      Merge tag 'drm-misc-fixes-2022-06-16' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes · 2f90ec12
      Dave Airlie authored
      Two fixes for TTM, one for a NULL pointer dereference and one to make sure
      the buffer is pinned prior to a bulk move, and a fix for a spurious
      compiler warning.
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Maxime Ripard <maxime@cerno.tech>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220616072519.qwrsefsemejefowu@houat
      2f90ec12
    • Linus Torvalds's avatar
      Merge tag 'audit-pr-20220616' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit · 0639b599
      Linus Torvalds authored
      Pull audit fix from Paul Moore:
       "A single audit patch to fix a problem where we were not properly
        freeing memory allocated when recording information related to a
        module load"
      
      * tag 'audit-pr-20220616' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit:
        audit: free module name
      0639b599
    • Linus Torvalds's avatar
      Merge tag 'selinux-pr-20220616' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux · 6decbf75
      Linus Torvalds authored
      Pull selinux fix from Paul Moore:
       "A single SELinux patch to fix memory leaks when mounting filesystems
        with SELinux mount options"
      
      * tag 'selinux-pr-20220616' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
        selinux: free contexts previously transferred in selinux_add_opt()
      6decbf75
    • Linus Torvalds's avatar
      Merge tag 'net-5.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 48a23ec6
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Mostly driver fixes.
      
        Current release - regressions:
      
         - Revert "net: Add a second bind table hashed by port and address",
           needs more work
      
         - amd-xgbe: use platform_irq_count(), static setup of IRQ resources
           had been removed from DT core
      
         - dts: at91: ksz9477_evb: add phy-mode to fix port/phy validation
      
        Current release - new code bugs:
      
         - hns3: modify the ring param print info
      
        Previous releases - always broken:
      
         - axienet: make the 64b addressable DMA depends on 64b architectures
      
         - iavf: fix issue with MAC address of VF shown as zero
      
         - ice: fix PTP TX timestamp offset calculation
      
         - usb: ax88179_178a needs FLAG_SEND_ZLP
      
        Misc:
      
         - document some net.sctp.* sysctls"
      
      * tag 'net-5.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (31 commits)
        net: axienet: add missing error return code in axienet_probe()
        Revert "net: Add a second bind table hashed by port and address"
        net: ax25: Fix deadlock caused by skb_recv_datagram in ax25_recvmsg
        net: usb: ax88179_178a needs FLAG_SEND_ZLP
        MAINTAINERS: add include/dt-bindings/net to NETWORKING DRIVERS
        ARM: dts: at91: ksz9477_evb: fix port/phy validation
        net: bgmac: Fix an erroneous kfree() in bgmac_remove()
        ice: Fix memory corruption in VF driver
        ice: Fix queue config fail handling
        ice: Sync VLAN filtering features for DVM
        ice: Fix PTP TX timestamp offset calculation
        mlxsw: spectrum_cnt: Reorder counter pools
        docs: networking: phy: Fix a typo
        amd-xgbe: Use platform_irq_count()
        octeontx2-vf: Add support for adaptive interrupt coalescing
        xilinx:  Fix build on x86.
        net: axienet: Use iowrite64 to write all 64b descriptor pointers
        net: axienet: make the 64b addresable DMA depends on 64b archectures
        net: hns3: fix tm port shapping of fibre port is incorrect after driver initialization
        net: hns3: fix PF rss size initialization bug
        ...
      48a23ec6
    • Yang Yingliang's avatar
      net: axienet: add missing error return code in axienet_probe() · 2e7bf4a6
      Yang Yingliang authored
      It should return error code in error path in axienet_probe().
      
      Fixes: 00be43a7 ("net: axienet: make the 64b addresable DMA depends on 64b archectures")
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Link: https://lore.kernel.org/r/20220616062917.3601-1-yangyingliang@huawei.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2e7bf4a6
    • Joanne Koong's avatar
      Revert "net: Add a second bind table hashed by port and address" · 593d1ebe
      Joanne Koong authored
      This reverts:
      
      commit d5a42de8 ("net: Add a second bind table hashed by port and address")
      commit 538aaf9b ("selftests: Add test for timing a bind request to a port with a populated bhash entry")
      Link: https://lore.kernel.org/netdev/20220520001834.2247810-1-kuba@kernel.org/
      
      There are a few things that need to be fixed here:
      * Updating bhash2 in cases where the socket's rcv saddr changes
      * Adding bhash2 hashbucket locks
      
      Links to syzbot reports:
      https://lore.kernel.org/netdev/00000000000022208805e0df247a@google.com/
      https://lore.kernel.org/netdev/0000000000003f33bc05dfaf44fe@google.com/
      
      Fixes: d5a42de8 ("net: Add a second bind table hashed by port and address")
      Reported-by: syzbot+015d756bbd1f8b5c8f09@syzkaller.appspotmail.com
      Reported-by: syzbot+98fd2d1422063b0f8c44@syzkaller.appspotmail.com
      Reported-by: syzbot+0a847a982613c6438fba@syzkaller.appspotmail.com
      Signed-off-by: default avatarJoanne Koong <joannelkoong@gmail.com>
      Link: https://lore.kernel.org/r/20220615193213.2419568-1-joannelkoong@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      593d1ebe
    • Christian Göttsche's avatar
      selinux: free contexts previously transferred in selinux_add_opt() · cad140d0
      Christian Göttsche authored
      `selinux_add_opt()` stopped taking ownership of the passed context since
      commit 70f4169a ("selinux: parse contexts for mount options early").
      
          unreferenced object 0xffff888114dfd140 (size 64):
            comm "mount", pid 15182, jiffies 4295687028 (age 796.340s)
            hex dump (first 32 bytes):
              73 79 73 74 65 6d 5f 75 3a 6f 62 6a 65 63 74 5f  system_u:object_
              72 3a 74 65 73 74 5f 66 69 6c 65 73 79 73 74 65  r:test_filesyste
            backtrace:
              [<ffffffffa07dbef4>] kmemdup_nul+0x24/0x80
              [<ffffffffa0d34253>] selinux_sb_eat_lsm_opts+0x293/0x560
              [<ffffffffa0d13f08>] security_sb_eat_lsm_opts+0x58/0x80
              [<ffffffffa0af1eb2>] generic_parse_monolithic+0x82/0x180
              [<ffffffffa0a9c1a5>] do_new_mount+0x1f5/0x550
              [<ffffffffa0a9eccb>] path_mount+0x2ab/0x1570
              [<ffffffffa0aa019e>] __x64_sys_mount+0x20e/0x280
              [<ffffffffa1f47124>] do_syscall_64+0x34/0x80
              [<ffffffffa200007e>] entry_SYSCALL_64_after_hwframe+0x46/0xb0
      
          unreferenced object 0xffff888108e71640 (size 64):
            comm "fsmount", pid 7607, jiffies 4295044974 (age 1601.016s)
            hex dump (first 32 bytes):
              73 79 73 74 65 6d 5f 75 3a 6f 62 6a 65 63 74 5f  system_u:object_
              72 3a 74 65 73 74 5f 66 69 6c 65 73 79 73 74 65  r:test_filesyste
            backtrace:
              [<ffffffff861dc2b1>] memdup_user+0x21/0x90
              [<ffffffff861dc367>] strndup_user+0x47/0xa0
              [<ffffffff864f6965>] __do_sys_fsconfig+0x485/0x9f0
              [<ffffffff87940124>] do_syscall_64+0x34/0x80
              [<ffffffff87a0007e>] entry_SYSCALL_64_after_hwframe+0x46/0xb0
      
      Cc: stable@vger.kernel.org
      Fixes: 70f4169a ("selinux: parse contexts for mount options early")
      Signed-off-by: default avatarChristian Göttsche <cgzones@googlemail.com>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      cad140d0
  3. 15 Jun, 2022 14 commits
  4. 14 Jun, 2022 4 commits
    • Linus Torvalds's avatar
      netfs: fix up netfs_inode_init() docbook comment · 018ab4fa
      Linus Torvalds authored
      Commit e81fb419 ("netfs: Further cleanups after struct netfs_inode
      wrapper introduced") changed the argument types and names, and actually
      updated the comment too (although that was thanks to David Howells, not
      me: my original patch only changed the code).
      
      But the comment fixup didn't go quite far enough, and didn't change the
      argument name in the comment, resulting in
      
        include/linux/netfs.h:314: warning: Function parameter or member 'ctx' not described in 'netfs_inode_init'
        include/linux/netfs.h:314: warning: Excess function parameter 'inode' description in 'netfs_inode_init'
      
      during htmldoc generation.
      
      Fixes: e81fb419 ("netfs: Further cleanups after struct netfs_inode wrapper introduced")
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      018ab4fa
    • Roman Li's avatar
      drm/amd/display: Cap OLED brightness per max frame-average luminance · 4fd17f2a
      Roman Li authored
      [Why]
      For OLED eDP the Display Manager uses max_cll value as a limit
      for brightness control.
      max_cll defines the content light luminance for individual pixel.
      Whereas max_fall defines frame-average level luminance.
      The user may not observe the difference in brightness in between
      max_fall and max_cll.
      That negatively impacts the user experience.
      
      [How]
      Use max_fall value instead of max_cll as a limit for brightness control.
      Reviewed-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Acked-by: default avatarHamza Mahfooz <hamza.mahfooz@amd.com>
      Signed-off-by: default avatarRoman Li <roman.li@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      4fd17f2a
    • Michel Dänzer's avatar
      drm/amdgpu: Fix GTT size reporting in amdgpu_ioctl · c904e3ac
      Michel Dänzer authored
      The commit below changed the TTM manager size unit from pages to
      bytes, but failed to adjust the corresponding calculations in
      amdgpu_ioctl.
      
      Fixes: dfa714b8 ("drm/amdgpu: remove GTT accounting v2")
      Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1930
      Bug: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6642Tested-by: default avatarMartin Roukala <martin.roukala@mupuf.org>
      Tested-by: default avatarMike Lothian <mike@fireburn.co.uk>
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarMichel Dänzer <mdaenzer@redhat.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org # 5.18.x
      c904e3ac
    • Przemyslaw Patynowski's avatar
      ice: Fix memory corruption in VF driver · efe41860
      Przemyslaw Patynowski authored
      Disable VF's RX/TX queues, when it's disabled. VF can have queues enabled,
      when it requests a reset. If PF driver assumes that VF is disabled,
      while VF still has queues configured, VF may unmap DMA resources.
      In such scenario device still can map packets to memory, which ends up
      silently corrupting it.
      Previously, VF driver could experience memory corruption, which lead to
      crash:
      [ 5119.170157] BUG: unable to handle kernel paging request at 00001b9780003237
      [ 5119.170166] PGD 0 P4D 0
      [ 5119.170173] Oops: 0002 [#1] PREEMPT_RT SMP PTI
      [ 5119.170181] CPU: 30 PID: 427592 Comm: kworker/u96:2 Kdump: loaded Tainted: G        W I      --------- -  - 4.18.0-372.9.1.rt7.166.el8.x86_64 #1
      [ 5119.170189] Hardware name: Dell Inc. PowerEdge R740/014X06, BIOS 2.3.10 08/15/2019
      [ 5119.170193] Workqueue: iavf iavf_adminq_task [iavf]
      [ 5119.170219] RIP: 0010:__page_frag_cache_drain+0x5/0x30
      [ 5119.170238] Code: 0f 0f b6 77 51 85 f6 74 07 31 d2 e9 05 df ff ff e9 90 fe ff ff 48 8b 05 49 db 33 01 eb b4 0f 1f 80 00 00 00 00 0f 1f 44 00 00 <f0> 29 77 34 74 01 c3 48 8b 07 f6 c4 80 74 0f 0f b6 77 51 85 f6 74
      [ 5119.170244] RSP: 0018:ffffa43b0bdcfd78 EFLAGS: 00010282
      [ 5119.170250] RAX: ffffffff896b3e40 RBX: ffff8fb282524000 RCX: 0000000000000002
      [ 5119.170254] RDX: 0000000049000000 RSI: 0000000000000000 RDI: 00001b9780003203
      [ 5119.170259] RBP: ffff8fb248217b00 R08: 0000000000000022 R09: 0000000000000009
      [ 5119.170262] R10: 2b849d6300000000 R11: 0000000000000020 R12: 0000000000000000
      [ 5119.170265] R13: 0000000000001000 R14: 0000000000000009 R15: 0000000000000000
      [ 5119.170269] FS:  0000000000000000(0000) GS:ffff8fb1201c0000(0000) knlGS:0000000000000000
      [ 5119.170274] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [ 5119.170279] CR2: 00001b9780003237 CR3: 00000008f3e1a003 CR4: 00000000007726e0
      [ 5119.170283] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [ 5119.170286] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [ 5119.170290] PKRU: 55555554
      [ 5119.170292] Call Trace:
      [ 5119.170298]  iavf_clean_rx_ring+0xad/0x110 [iavf]
      [ 5119.170324]  iavf_free_rx_resources+0xe/0x50 [iavf]
      [ 5119.170342]  iavf_free_all_rx_resources.part.51+0x30/0x40 [iavf]
      [ 5119.170358]  iavf_virtchnl_completion+0xd8a/0x15b0 [iavf]
      [ 5119.170377]  ? iavf_clean_arq_element+0x210/0x280 [iavf]
      [ 5119.170397]  iavf_adminq_task+0x126/0x2e0 [iavf]
      [ 5119.170416]  process_one_work+0x18f/0x420
      [ 5119.170429]  worker_thread+0x30/0x370
      [ 5119.170437]  ? process_one_work+0x420/0x420
      [ 5119.170445]  kthread+0x151/0x170
      [ 5119.170452]  ? set_kthread_struct+0x40/0x40
      [ 5119.170460]  ret_from_fork+0x35/0x40
      [ 5119.170477] Modules linked in: iavf sctp ip6_udp_tunnel udp_tunnel mlx4_en mlx4_core nfp tls vhost_net vhost vhost_iotlb tap tun xt_CHECKSUM ipt_MASQUERADE xt_conntrack ipt_REJECT nf_reject_ipv4 nft_compat nft_counter nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables nfnetlink bridge stp llc rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache sunrpc intel_rapl_msr iTCO_wdt iTCO_vendor_support dell_smbios wmi_bmof dell_wmi_descriptor dcdbas kvm_intel kvm irqbypass intel_rapl_common isst_if_common skx_edac irdma nfit libnvdimm x86_pkg_temp_thermal i40e intel_powerclamp coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_intel ib_uverbs rapl ipmi_ssif intel_cstate intel_uncore mei_me pcspkr acpi_ipmi ib_core mei lpc_ich i2c_i801 ipmi_si ipmi_devintf wmi ipmi_msghandler acpi_power_meter xfs libcrc32c sd_mod t10_pi sg mgag200 drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ice ahci drm libahci crc32c_intel libata tg3 megaraid_sas
      [ 5119.170613]  i2c_algo_bit dm_mirror dm_region_hash dm_log dm_mod fuse [last unloaded: iavf]
      [ 5119.170627] CR2: 00001b9780003237
      
      Fixes: ec4f5a43 ("ice: Check if VF is disabled for Opcode and other operations")
      Signed-off-by: default avatarPrzemyslaw Patynowski <przemyslawx.patynowski@intel.com>
      Co-developed-by: default avatarSlawomir Laba <slawomirx.laba@intel.com>
      Signed-off-by: default avatarSlawomir Laba <slawomirx.laba@intel.com>
      Signed-off-by: default avatarMateusz Palczewski <mateusz.palczewski@intel.com>
      Tested-by: default avatarKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      efe41860