Skip to content
Snippets Groups Projects
  1. Jun 22, 2023
  2. Jun 20, 2023
  3. Jun 18, 2023
  4. Jun 16, 2023
    • Dave Airlie's avatar
      nouveau: fix client work fence deletion race · c8a5d5ea
      Dave Airlie authored
      
      This seems to have existed for ever but is now more apparant after
      commit 9bff18d1 ("drm/ttm: use per BO cleanup workers")
      
      My analysis: two threads are running, one in the irq signalling the
      fence, in dma_fence_signal_timestamp_locked, it has done the
      DMA_FENCE_FLAG_SIGNALLED_BIT setting, but hasn't yet reached the
      callbacks.
      
      The second thread in nouveau_cli_work_ready, where it sees the fence is
      signalled, so then puts the fence, cleanups the object and frees the
      work item, which contains the callback.
      
      Thread one goes again and tries to call the callback and causes the
      use-after-free.
      
      Proposed fix: lock the fence signalled check in nouveau_cli_work_ready,
      so either the callbacks are done or the memory is freed.
      
      Reviewed-by: default avatarKarol Herbst <kherbst@redhat.com>
      Fixes: 11e451e7 ("drm/nouveau: remove fence wait code from deferred client work handler")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      Link: https://lore.kernel.org/dri-devel/20230615024008.1600281-1-airlied@gmail.com/
      c8a5d5ea
  5. Jun 15, 2023
    • Jiasheng Jiang's avatar
      octeon_ep: Add missing check for ioremap · 9a36e2d4
      Jiasheng Jiang authored
      
      Add check for ioremap() and return the error if it fails in order to
      guarantee the success of ioremap().
      
      Fixes: 862cd659 ("octeon_ep: Add driver framework and device initialization")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Reviewed-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Link: https://lore.kernel.org/r/20230615033400.2971-1-jiasheng@iscas.ac.cn
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9a36e2d4
    • Christian Marangi's avatar
      net: ethernet: stmicro: stmmac: fix possible memory leak in __stmmac_open · 30134b7c
      Christian Marangi authored
      
      Fix a possible memory leak in __stmmac_open when stmmac_init_phy fails.
      It's also needed to free everything allocated by stmmac_setup_dma_desc
      and not just the dma_conf struct.
      
      Drop free_dma_desc_resources from __stmmac_open and correctly call
      free_dma_desc_resources on each user of __stmmac_open on error.
      
      Reported-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
      Fixes: ba39b344 ("net: ethernet: stmicro: stmmac: generate stmmac dma conf before open")
      Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Reviewed-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
      Link: https://lore.kernel.org/r/20230614091714.15912-1-ansuelsmth@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      30134b7c
    • Mike Snitzer's avatar
      dm: use op specific max_sectors when splitting abnormal io · be04c14a
      Mike Snitzer authored
      
      Split abnormal IO in terms of the corresponding operation specific
      max_sectors (max_discard_sectors, max_secure_erase_sectors or
      max_write_zeroes_sectors).
      
      This fixes a significant dm-thinp discard performance regression that
      was introduced with commit e2dd8aca ("dm bio prison v1: improve
      concurrent IO performance"). Relative to discard: max_discard_sectors
      is used instead of max_sectors; which fixes excessive discard splitting
      (e.g. max_sectors=128K vs max_discard_sectors=64M).
      
      Tested by discarding an 1 Petabyte dm-thin device:
      lvcreate -V 1125899906842624B -T test/pool -n thin
      time blkdiscard /dev/test/thin
      
      Before this fix (splitting discards every 128K): ~116m
       After this fix (splitting discards every 64M) : 0m33.460s
      
      Reported-by: default avatarZorro Lang <zlang@redhat.com>
      Fixes: 06961c48 ("dm: split discards further if target sets max_discard_granularity")
      Requires: 13f6facf ("dm: allow targets to require splitting WRITE_ZEROES and SECURE_ERASE")
      Fixes: e2dd8aca ("dm bio prison v1: improve concurrent IO performance")
      Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
      be04c14a
    • Mike Snitzer's avatar
      dm thin: fix issue_discard to pass GFP_NOIO to __blkdev_issue_discard · 722d9082
      Mike Snitzer authored
      
      issue_discard() passes GFP_NOWAIT to __blkdev_issue_discard() despite
      its code assuming bio_alloc() always succeeds.
      
      Commit 3dba53a9 ("dm thin: use __blkdev_issue_discard for async
      discard support") clearly shows where things went bad:
      
      Before commit 3dba53a9, dm-thin.c's open-coded
      __blkdev_issue_discard_async() properly handled using GFP_NOWAIT.
      Unfortunately __blkdev_issue_discard() doesn't and it was missed
      during review.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
      722d9082
    • Li Lingfeng's avatar
      dm thin metadata: check fail_io before using data_sm · cb65b282
      Li Lingfeng authored
      
      Must check pmd->fail_io before using pmd->data_sm since
      pmd->data_sm may be destroyed by other processes.
      
             P1(kworker)                             P2(message)
      do_worker
       process_prepared
        process_prepared_discard_passdown_pt2
         dm_pool_dec_data_range
                                          pool_message
                                           commit
                                            dm_pool_commit_metadata
                                              ↓
                                             // commit failed
                                            metadata_operation_failed
                                             abort_transaction
                                              dm_pool_abort_metadata
                                               __open_or_format_metadata
                                                 ↓
                                                dm_sm_disk_open
                                                  ↓
                                                 // open failed
                                                 // pmd->data_sm is NULL
          dm_sm_dec_blocks
            ↓
           // try to access pmd->data_sm --> UAF
      
      As shown above, if dm_pool_commit_metadata() and
      dm_pool_abort_metadata() fail in pool_message process, kworker may
      trigger UAF.
      
      Fixes: be500ed7 ("dm space maps: improve performance with inc/dec on ranges of blocks")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarLi Lingfeng <lilingfeng3@huawei.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
      cb65b282
    • Li Lingfeng's avatar
      dm: don't lock fs when the map is NULL during suspend or resume · 2760904d
      Li Lingfeng authored
      
      As described in commit 38d11da5 ("dm: don't lock fs when the map is
      NULL in process of resume"), a deadlock may be triggered between
      do_resume() and do_mount().
      
      This commit preserves the fix from commit 38d11da5 but moves it to
      where it also serves to fix a similar deadlock between do_suspend()
      and do_mount().  It does so, if the active map is NULL, by clearing
      DM_SUSPEND_LOCKFS_FLAG in dm_suspend() which is called by both
      do_suspend() and do_resume().
      
      Fixes: 38d11da5 ("dm: don't lock fs when the map is NULL in process of resume")
      Signed-off-by: default avatarLi Lingfeng <lilingfeng3@huawei.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
      2760904d
    • Íñigo Huguet's avatar
      sfc: fix XDP queues mode with legacy IRQ · e84a1e1e
      Íñigo Huguet authored
      
      In systems without MSI-X capabilities, xdp_txq_queues_mode is calculated
      in efx_allocate_msix_channels, but when enabling MSI-X fails, it was not
      changed to a proper default value. This was leading to the driver
      thinking that it has dedicated XDP queues, when it didn't.
      
      Fix it by setting xdp_txq_queues_mode to the correct value if the driver
      fallbacks to MSI or legacy IRQ mode. The correct value is
      EFX_XDP_TX_QUEUES_BORROWED because there are no XDP dedicated queues.
      
      The issue can be easily visible if the kernel is started with pci=nomsi,
      then a call trace is shown. It is not shown only with sfc's modparam
      interrupt_mode=2. Call trace example:
       WARNING: CPU: 2 PID: 663 at drivers/net/ethernet/sfc/efx_channels.c:828 efx_set_xdp_channels+0x124/0x260 [sfc]
       [...skip...]
       Call Trace:
        <TASK>
        efx_set_channels+0x5c/0xc0 [sfc]
        efx_probe_nic+0x9b/0x15a [sfc]
        efx_probe_all+0x10/0x1a2 [sfc]
        efx_pci_probe_main+0x12/0x156 [sfc]
        efx_pci_probe_post_io+0x18/0x103 [sfc]
        efx_pci_probe.cold+0x154/0x257 [sfc]
        local_pci_probe+0x42/0x80
      
      Fixes: 6215b608 ("sfc: last resort fallback for lack of xdp tx queues")
      Reported-by: default avatarYanghang Liu <yanghliu@redhat.com>
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Acked-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e84a1e1e
    • Fedor Pchelkin's avatar
      net: macsec: fix double free of percpu stats · 0c0cf3db
      Fedor Pchelkin authored
      
      Inside macsec_add_dev() we free percpu macsec->secy.tx_sc.stats and
      macsec->stats on some of the memory allocation failure paths. However, the
      net_device is already registered to that moment: in macsec_newlink(), just
      before calling macsec_add_dev(). This means that during unregister process
      its priv_destructor - macsec_free_netdev() - will be called and will free
      the stats again.
      
      Remove freeing percpu stats inside macsec_add_dev() because
      macsec_free_netdev() will correctly free the already allocated ones. The
      pointers to unallocated stats stay NULL, and free_percpu() treats that
      correctly.
      
      Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
      
      Fixes: 0a28bfd4 ("net/macsec: Add MACsec skb_metadata_dst Tx Data path support")
      Fixes: c09440f7 ("macsec: introduce IEEE 802.1AE driver")
      Signed-off-by: default avatarFedor Pchelkin <pchelkin@ispras.ru>
      Reviewed-by: default avatarSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0c0cf3db
    • Eric Dumazet's avatar
      net: lapbether: only support ethernet devices · 9eed321c
      Eric Dumazet authored
      
      It probbaly makes no sense to support arbitrary network devices
      for lapbether.
      
      syzbot reported:
      
      skbuff: skb_under_panic: text:ffff80008934c100 len:44 put:40 head:ffff0000d18dd200 data:ffff0000d18dd1ea tail:0x16 end:0x140 dev:bond1
      kernel BUG at net/core/skbuff.c:200 !
      Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
      Modules linked in:
      CPU: 0 PID: 5643 Comm: dhcpcd Not tainted 6.4.0-rc5-syzkaller-g4641cff8e810 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
      pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      pc : skb_panic net/core/skbuff.c:196 [inline]
      pc : skb_under_panic+0x13c/0x140 net/core/skbuff.c:210
      lr : skb_panic net/core/skbuff.c:196 [inline]
      lr : skb_under_panic+0x13c/0x140 net/core/skbuff.c:210
      sp : ffff8000973b7260
      x29: ffff8000973b7270 x28: ffff8000973b7360 x27: dfff800000000000
      x26: ffff0000d85d8150 x25: 0000000000000016 x24: ffff0000d18dd1ea
      x23: ffff0000d18dd200 x22: 000000000000002c x21: 0000000000000140
      x20: 0000000000000028 x19: ffff80008934c100 x18: ffff8000973b68a0
      x17: 0000000000000000 x16: ffff80008a43bfbc x15: 0000000000000202
      x14: 0000000000000000 x13: 0000000000000001 x12: 0000000000000001
      x11: 0000000000000201 x10: 0000000000000000 x9 : f22f7eb937cced00
      x8 : f22f7eb937cced00 x7 : 0000000000000001 x6 : 0000000000000001
      x5 : ffff8000973b6b78 x4 : ffff80008df9ee80 x3 : ffff8000805974f4
      x2 : 0000000000000001 x1 : 0000000100000201 x0 : 0000000000000086
      Call trace:
      skb_panic net/core/skbuff.c:196 [inline]
      skb_under_panic+0x13c/0x140 net/core/skbuff.c:210
      skb_push+0xf0/0x108 net/core/skbuff.c:2409
      ip6gre_header+0xbc/0x738 net/ipv6/ip6_gre.c:1383
      dev_hard_header include/linux/netdevice.h:3137 [inline]
      lapbeth_data_transmit+0x1c4/0x298 drivers/net/wan/lapbether.c:257
      lapb_data_transmit+0x8c/0xb0 net/lapb/lapb_iface.c:447
      lapb_transmit_buffer+0x178/0x204 net/lapb/lapb_out.c:149
      lapb_send_control+0x220/0x320 net/lapb/lapb_subr.c:251
      lapb_establish_data_link+0x94/0xec
      lapb_device_event+0x348/0x4e0
      notifier_call_chain+0x1a4/0x510 kernel/notifier.c:93
      raw_notifier_call_chain+0x3c/0x50 kernel/notifier.c:461
      __dev_notify_flags+0x2bc/0x544
      dev_change_flags+0xd0/0x15c net/core/dev.c:8643
      devinet_ioctl+0x858/0x17e4 net/ipv4/devinet.c:1150
      inet_ioctl+0x2ac/0x4d8 net/ipv4/af_inet.c:979
      sock_do_ioctl+0x134/0x2dc net/socket.c:1201
      sock_ioctl+0x4ec/0x858 net/socket.c:1318
      vfs_ioctl fs/ioctl.c:51 [inline]
      __do_sys_ioctl fs/ioctl.c:870 [inline]
      __se_sys_ioctl fs/ioctl.c:856 [inline]
      __arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:856
      __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
      invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
      el0_svc_common+0x138/0x244 arch/arm64/kernel/syscall.c:142
      do_el0_svc+0x64/0x198 arch/arm64/kernel/syscall.c:191
      el0_svc+0x4c/0x160 arch/arm64/kernel/entry-common.c:647
      el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:665
      el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591
      Code: aa1803e6 aa1903e7 a90023f5 947730f5 (d4210000)
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Martin Schiller <ms@dev.tdt.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9eed321c
    • Julian Ruess's avatar
      s390/ism: Fix trying to free already-freed IRQ by repeated ism_dev_exit() · 78d0f949
      Julian Ruess authored
      
      This patch prevents the system from crashing when unloading the ISM module.
      
      How to reproduce: Attach an ISM device and execute 'rmmod ism'.
      
      Error-Log:
      - Trying to free already-free IRQ 0
      - WARNING: CPU: 1 PID: 966 at kernel/irq/manage.c:1890 free_irq+0x140/0x540
      
      After calling ism_dev_exit() for each ISM device in the exit routine,
      pci_unregister_driver() will execute ism_remove() for each ISM device.
      Because ism_remove() also calls ism_dev_exit(),
      free_irq(pci_irq_vector(pdev, 0), ism) is called twice for each ISM
      device. This results in a crash with the error
      'Trying to free already-free IRQ'.
      
      In the exit routine, it is enough to call pci_unregister_driver()
      because it ensures that ism_dev_exit() is called once per
      ISM device.
      
      Cc: <stable@vger.kernel.org> # 6.3+
      Fixes: 89e7d2ba ("net/ism: Add new API for client registration")
      Reviewed-by: default avatarNiklas Schnelle <schnelle@linux.ibm.com>
      Signed-off-by: default avatarJulian Ruess <julianr@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      78d0f949
    • Vladimir Oltean's avatar
      net: dsa: felix: fix taprio guard band overflow at 10Mbps with jumbo frames · 6ac7a27a
      Vladimir Oltean authored
      
      The DEV_MAC_MAXLEN_CFG register contains a 16-bit value - up to 65535.
      Plus 2 * VLAN_HLEN (4), that is up to 65543.
      
      The picos_per_byte variable is the largest when "speed" is lowest -
      SPEED_10 = 10. In that case it is (1000000L * 8) / 10 = 800000.
      
      Their product - 52434400000 - exceeds 32 bits, which is a problem,
      because apparently, a multiplication between two 32-bit factors is
      evaluated as 32-bit before being assigned to a 64-bit variable.
      In fact it's a problem for any MTU value larger than 5368.
      
      Cast one of the factors of the multiplication to u64 to force the
      multiplication to take place on 64 bits.
      
      Issue found by Coverity.
      
      Fixes: 55a515b1 ("net: dsa: felix: drop oversized frames with tc-taprio instead of hanging the port")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Link: https://lore.kernel.org/r/20230613170907.2413559-1-vladimir.oltean@nxp.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      6ac7a27a
    • Jakub Buchocki's avatar
      ice: Fix ice module unload · 24b454bc
      Jakub Buchocki authored
      
      Clearing the interrupt scheme before PFR reset,
      during the removal routine, could cause the hardware
      errors and possibly lead to system reboot, as the PF
      reset can cause the interrupt to be generated.
      
      Place the call for PFR reset inside ice_deinit_dev(),
      wait until reset and all pending transactions are done,
      then call ice_clear_interrupt_scheme().
      
      This introduces a PFR reset to multiple error paths.
      
      Additionally, remove the call for the reset from
      ice_load() - it will be a part of ice_unload() now.
      
      Error example:
      [   75.229328] ice 0000:ca:00.1: Failed to read Tx Scheduler Tree - User Selection data from flash
      [   77.571315] {1}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 1
      [   77.571418] {1}[Hardware Error]: event severity: recoverable
      [   77.571459] {1}[Hardware Error]:  Error 0, type: recoverable
      [   77.571500] {1}[Hardware Error]:   section_type: PCIe error
      [   77.571540] {1}[Hardware Error]:   port_type: 4, root port
      [   77.571580] {1}[Hardware Error]:   version: 3.0
      [   77.571615] {1}[Hardware Error]:   command: 0x0547, status: 0x4010
      [   77.571661] {1}[Hardware Error]:   device_id: 0000:c9:02.0
      [   77.571703] {1}[Hardware Error]:   slot: 25
      [   77.571736] {1}[Hardware Error]:   secondary_bus: 0xca
      [   77.571773] {1}[Hardware Error]:   vendor_id: 0x8086, device_id: 0x347a
      [   77.571821] {1}[Hardware Error]:   class_code: 060400
      [   77.571858] {1}[Hardware Error]:   bridge: secondary_status: 0x2800, control: 0x0013
      [   77.572490] pcieport 0000:c9:02.0: AER: aer_status: 0x00200000, aer_mask: 0x00100020
      [   77.572870] pcieport 0000:c9:02.0:    [21] ACSViol                (First)
      [   77.573222] pcieport 0000:c9:02.0: AER: aer_layer=Transaction Layer, aer_agent=Receiver ID
      [   77.573554] pcieport 0000:c9:02.0: AER: aer_uncor_severity: 0x00463010
      [   77.691273] {2}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 1
      [   77.691738] {2}[Hardware Error]: event severity: recoverable
      [   77.691971] {2}[Hardware Error]:  Error 0, type: recoverable
      [   77.692192] {2}[Hardware Error]:   section_type: PCIe error
      [   77.692403] {2}[Hardware Error]:   port_type: 4, root port
      [   77.692616] {2}[Hardware Error]:   version: 3.0
      [   77.692825] {2}[Hardware Error]:   command: 0x0547, status: 0x4010
      [   77.693032] {2}[Hardware Error]:   device_id: 0000:c9:02.0
      [   77.693238] {2}[Hardware Error]:   slot: 25
      [   77.693440] {2}[Hardware Error]:   secondary_bus: 0xca
      [   77.693641] {2}[Hardware Error]:   vendor_id: 0x8086, device_id: 0x347a
      [   77.693853] {2}[Hardware Error]:   class_code: 060400
      [   77.694054] {2}[Hardware Error]:   bridge: secondary_status: 0x0800, control: 0x0013
      [   77.719115] pci 0000:ca:00.1: AER: can't recover (no error_detected callback)
      [   77.719140] pcieport 0000:c9:02.0: AER: device recovery failed
      [   77.719216] pcieport 0000:c9:02.0: AER: aer_status: 0x00200000, aer_mask: 0x00100020
      [   77.719390] pcieport 0000:c9:02.0:    [21] ACSViol                (First)
      [   77.719557] pcieport 0000:c9:02.0: AER: aer_layer=Transaction Layer, aer_agent=Receiver ID
      [   77.719723] pcieport 0000:c9:02.0: AER: aer_uncor_severity: 0x00463010
      
      Fixes: 5b246e53 ("ice: split probe into smaller functions")
      Signed-off-by: default avatarJakub Buchocki <jakubx.buchocki@intel.com>
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Link: https://lore.kernel.org/r/20230612171421.21570-1-anthony.l.nguyen@intel.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      24b454bc
    • Justin Tee's avatar
      scsi: lpfc: Fix incorrect big endian type assignment in bsg loopback path · 9cefd6e7
      Justin Tee authored
      
      The kernel test robot reported sparse warnings regarding incorrect type
      assignment for __be16 variables in bsg loopback path.
      
      Change the flagged lines to use the be16_to_cpu() and cpu_to_be16() macros
      appropriately.
      
      Signed-off-by: default avatarJustin Tee <justin.tee@broadcom.com>
      Link: https://lore.kernel.org/r/20230614175944.3577-1-justintee8345@gmail.com
      
      
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Closes: https://lore.kernel.org/oe-kbuild-all/202306110819.sDIKiGgg-lkp@intel.com/
      
      
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      9cefd6e7
    • Bob Pearson's avatar
      scsi: target: core: Fix error path in target_setup_session() · 91271699
      Bob Pearson authored
      
      In the error exits in target_setup_session(), if a branch is taken to
      free_sess: transport_free_session() may call to target_free_cmd_counter()
      and then fall through to call target_free_cmd_counter() a second time.
      This can, and does, sometimes cause seg faults since the data field in
      cmd_cnt->refcnt has been freed in the first call.
      
      Fix this problem by simply returning after the call to
      transport_free_session(). The second call is redundant for those cases.
      
      Fixes: 4edba7e4 ("scsi: target: Move cmd counter allocation")
      Signed-off-by: default avatarBob Pearson <rpearsonhpe@gmail.com>
      Link: https://lore.kernel.org/r/20230613144259.12890-1-rpearsonhpe@gmail.com
      
      
      Reviewed-by: default avatarMike Christie <michael.christie@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      91271699
    • Michael Kelley's avatar
      scsi: storvsc: Always set no_report_opcodes · 31d16e71
      Michael Kelley authored
      
      Hyper-V synthetic SCSI devices do not support the MAINTENANCE_IN SCSI
      command, so scsi_report_opcode() always fails, resulting in messages like
      this:
      
      hv_storvsc <guid>: tag#205 cmd 0xa3 status: scsi 0x2 srb 0x86 hv 0xc0000001
      
      The recently added support for command duration limits calls
      scsi_report_opcode() four times as each device comes online, which
      significantly increases the number of messages logged in a system with many
      disks.
      
      Fix the problem by always marking Hyper-V synthetic SCSI devices as not
      supporting scsi_report_opcode(). With this setting, the MAINTENANCE_IN SCSI
      command is not issued and no messages are logged.
      
      Signed-off-by: default avatarMichael Kelley <mikelley@microsoft.com>
      Link: https://lore.kernel.org/r/1686343101-18930-1-git-send-email-mikelley@microsoft.com
      
      
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      31d16e71
    • Sagar Biradar's avatar
      scsi: aacraid: Reply queue mapping to CPUs based on IRQ affinity · 9dc704dc
      Sagar Biradar authored
      
      Fix the I/O hang that arises because of the MSIx vector not having a mapped
      online CPU upon receiving completion.
      
      SCSI cmds take the blk_mq route, which is setup during init. Reserved cmds
      fetch the vector_no from mq_map after init is complete. Before init, they
      have to use 0 - as per the norm.
      
      Reviewed-by: default avatarGilbert Wu <gilbert.wu@microchip.com>
      Signed-off-by: default avatarSagar Biradar <Sagar.Biradar@microchip.com>
      Reviewed-by: default avatarJohn Garry <john.g.garry@oracle.com>
      Link: https://lore.kernel.org/r/20230519230834.27436-1-sagar.biradar@microchip.com
      
      
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      9dc704dc
    • Arnd Bergmann's avatar
      clk: pxa: fix NULL pointer dereference in pxa3xx_clk_update_accr · 23200a4c
      Arnd Bergmann authored
      
      sparse points out an embarrasing bug in an older patch of mine,
      which uses the register offset instead of an __iomem pointer:
      
      drivers/clk/pxa/clk-pxa3xx.c:167:9: sparse: sparse: Using plain integer as NULL pointer
      
      Unlike sparse, gcc and clang ignore this bug and fail to warn
      because a literal '0' is considered a valid representation of
      a NULL pointer.
      
      Fixes: 3c816d95 ("ARM: pxa: move clk register definitions to driver")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Link: https://lore.kernel.org/oe-kbuild-all/202305111301.RAHohdob-lkp@intel.com/
      
      
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/r/20230511105845.299859-1-arnd@kernel.org
      
      
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      23200a4c
  6. Jun 14, 2023
    • Mauro Carvalho Chehab's avatar
      Revert "media: dvb-core: Fix use-after-free on race condition at dvb_frontend" · ec21a38d
      Mauro Carvalho Chehab authored
      As reported by Thomas Voegtle <tv@lio96.de>, sometimes a DVB card does
      not initialize properly booting Linux 6.4-rc4. This is not always, maybe
      in 3 out of 4 attempts.
      
      After double-checking, the root cause seems to be related to the
      UAF fix, which is causing a race issue:
      
      [   26.332149] tda10071 7-0005: found a 'NXP TDA10071' in cold state, will try to load a firmware
      [   26.340779] tda10071 7-0005: downloading firmware from file 'dvb-fe-tda10071.fw'
      [  989.277402] INFO: task vdr:743 blocked for more than 491 seconds.
      [  989.283504]       Not tainted 6.4.0-rc5-i5 #249
      [  989.288036] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      [  989.295860] task:vdr             state:D stack:0     pid:743   ppid:711    flags:0x00004002
      [  989.295865] Call Trace:
      [  989.295867]  <TASK>
      [  989.295869]  __schedule+0x2ea/0x12d0
      [  989.295877]  ? asm_sysvec_apic_timer_interrupt+0x16/0x20
      [  989.295881]  schedule+0x57/0xc0
      [  989.295884]  schedule_preempt_disabled+0xc/0x20
      [  989.295887]  __mutex_lock.isra.16+0x237/0x480
      [  989.295891]  ? dvb_get_property.isra.10+0x1bc/0xa50
      [  989.295898]  ? dvb_frontend_stop+0x36/0x180
      [  989.338777]  dvb_frontend_stop+0x36/0x180
      [  989.338781]  dvb_frontend_open+0x2f1/0x470
      [  989.338784]  dvb_device_open+0x81/0xf0
      [  989.338804]  ? exact_lock+0x20/0x20
      [  989.338808]  chrdev_open+0x7f/0x1c0
      [  989.338811]  ? generic_permission+0x1a2/0x230
      [  989.338813]  ? link_path_walk.part.63+0x340/0x380
      [  989.338815]  ? exact_lock+0x20/0x20
      [  989.338817]  do_dentry_open+0x18e/0x450
      [  989.374030]  path_openat+0xca5/0xe00
      [  989.374031]  ? terminate_walk+0xec/0x100
      [  989.374034]  ? path_lookupat+0x93/0x140
      [  989.374036]  do_filp_open+0xc0/0x140
      [  989.374038]  ? __call_rcu_common.constprop.91+0x92/0x240
      [  989.374041]  ? __check_object_size+0x147/0x260
      [  989.374043]  ? __check_object_size+0x147/0x260
      [  989.374045]  ? alloc_fd+0xbb/0x180
      [  989.374048]  ? do_sys_openat2+0x243/0x310
      [  989.374050]  do_sys_openat2+0x243/0x310
      [  989.374052]  do_sys_open+0x52/0x80
      [  989.374055]  do_syscall_64+0x5b/0x80
      [  989.421335]  ? __task_pid_nr_ns+0x92/0xa0
      [  989.421337]  ? syscall_exit_to_user_mode+0x20/0x40
      [  989.421339]  ? do_syscall_64+0x67/0x80
      [  989.421341]  ? syscall_exit_to_user_mode+0x20/0x40
      [  989.421343]  ? do_syscall_64+0x67/0x80
      [  989.421345]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
      [  989.421348] RIP: 0033:0x7fe895d067e3
      [  989.421349] RSP: 002b:00007fff933c2ba0 EFLAGS: 00000293 ORIG_RAX: 0000000000000101
      [  989.421351] RAX: ffffffffffffffda RBX: 00007fff933c2c10 RCX: 00007fe895d067e3
      [  989.421352] RDX: 0000000000000802 RSI: 00005594acdce160 RDI: 00000000ffffff9c
      [  989.421353] RBP: 0000000000000802 R08: 0000000000000000 R09: 0000000000000000
      [  989.421353] R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000001
      [  989.421354] R13: 00007fff933c2ca0 R14: 00000000ffffffff R15: 00007fff933c2c90
      [  989.421355]  </TASK>
      
      This reverts commit 6769a0b7.
      
      Fixes: 6769a0b7 ("media: dvb-core: Fix use-after-free on race condition at dvb_frontend")
      Link: https://lore.kernel.org/all/da5382ad-09d6-20ac-0d53-611594b30861@lio96.de/
      
      
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      ec21a38d
    • Bob Pearson's avatar
      RDMA/rxe: Fix rxe_cq_post · 0c7e314a
      Bob Pearson authored
      A recent patch replaced a tasklet execution of cq->comp_handler by a
      direct call. While this made sense it let changes to cq->notify state be
      unprotected and assumed that the cq completion machinery and the ulp done
      callbacks were reentrant. The result is that in some cases completion
      events can be lost. This patch moves the cq->comp_handler call inside of
      the spinlock in rxe_cq_post which solves both issues. This is compatible
      with the matching code in the request notify verb.
      
      Fixes: 78b26a33 ("RDMA/rxe: Remove tasklet call from rxe_cq.c")
      Link: https://lore.kernel.org/r/20230612155032.17036-1-rpearsonhpe@gmail.com
      
      
      Signed-off-by: default avatarBob Pearson <rpearsonhpe@gmail.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      0c7e314a
    • Hugh Dickins's avatar
      wifi: iwlwifi: mvm: spin_lock_bh() to fix lockdep regression · f1a0898b
      Hugh Dickins authored
      
      Lockdep on 6.4-rc on ThinkPad X1 Carbon 5th says
      =====================================================
      WARNING: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected
      6.4.0-rc5 #1 Not tainted
      -----------------------------------------------------
      kworker/3:1/49 [HC0[0]:SC0[4]:HE1:SE0] is trying to acquire:
      ffff8881066fa368 (&mvm_sta->deflink.lq_sta.rs_drv.pers.lock){+.+.}-{2:2}, at: rs_drv_get_rate+0x46/0xe7
      
      and this task is already holding:
      ffff8881066f80a8 (&sta->rate_ctrl_lock){+.-.}-{2:2}, at: rate_control_get_rate+0xbd/0x126
      which would create a new lock dependency:
       (&sta->rate_ctrl_lock){+.-.}-{2:2} -> (&mvm_sta->deflink.lq_sta.rs_drv.pers.lock){+.+.}-{2:2}
      
      but this new dependency connects a SOFTIRQ-irq-safe lock:
       (&sta->rate_ctrl_lock){+.-.}-{2:2}
      etc. etc. etc.
      
      Changing the spin_lock() in rs_drv_get_rate() to spin_lock_bh() was not
      enough to pacify lockdep, but changing them all on pers.lock has worked.
      
      Fixes: a8938bc8 ("wifi: iwlwifi: mvm: Add locking to the rate read flow")
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Link: https://lore.kernel.org/r/79ffcc22-9775-cb6d-3ffd-1a517c40beef@google.com
      
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      f1a0898b
    • Dan Carpenter's avatar
      net: ethernet: ti: am65-cpsw: Call of_node_put() on error path · 374283a1
      Dan Carpenter authored
      
      This code returns directly but it should instead call of_node_put()
      to drop some reference counts.
      
      Fixes: dab2b265 ("net: ethernet: ti: am65-cpsw: Add support for SERDES configuration")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Reviewed-by: default avatarRoger Quadros <rogerq@kernel.org>
      Link: https://lore.kernel.org/r/e3012f0c-1621-40e6-bf7d-03c276f6e07f@kili.mountain
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      374283a1
  7. Jun 13, 2023
Loading