Skip to content
  1. Jul 08, 2023
    • 蒋家盛's avatar
      NTB: ntb_tool: Add check for devm_kcalloc · 2790143f
      蒋家盛 authored
      
      
      As the devm_kcalloc may return NULL pointer,
      it should be better to add check for the return
      value, as same as the others.
      
      Fixes: 7f46c8b3 ("NTB: ntb_tool: Add full multi-port NTB API support")
      Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
      Reviewed-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      2790143f
    • Yang Yingliang's avatar
      NTB: ntb_transport: fix possible memory leak while device_register() fails · 8623ccbf
      Yang Yingliang authored
      
      
      If device_register() returns error, the name allocated by
      dev_set_name() need be freed. As comment of device_register()
      says, it should use put_device() to give up the reference in
      the error path. So fix this by calling put_device(), then the
      name can be freed in kobject_cleanup(), and client_dev is freed
      in ntb_transport_client_release().
      
      Fixes: fce8a7bb ("PCI-Express Non-Transparent Bridge Support")
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      8623ccbf
    • Yuan Can's avatar
      ntb: intel: Fix error handling in intel_ntb_pci_driver_init() · 4c3c796a
      Yuan Can authored
      
      
      A problem about ntb_hw_intel create debugfs failed is triggered with the
      following log given:
      
       [  273.112733] Intel(R) PCI-E Non-Transparent Bridge Driver 2.0
       [  273.115342] debugfs: Directory 'ntb_hw_intel' with parent '/' already present!
      
      The reason is that intel_ntb_pci_driver_init() returns
      pci_register_driver() directly without checking its return value, if
      pci_register_driver() failed, it returns without destroy the newly created
      debugfs, resulting the debugfs of ntb_hw_intel can never be created later.
      
       intel_ntb_pci_driver_init()
         debugfs_create_dir() # create debugfs directory
         pci_register_driver()
           driver_register()
             bus_add_driver()
               priv = kzalloc(...) # OOM happened
         # return without destroy debugfs directory
      
      Fix by removing debugfs when pci_register_driver() returns error.
      
      Fixes: e26a5843 ("NTB: Split ntb_hw_intel and ntb_transport drivers")
      Signed-off-by: default avatarYuan Can <yuancan@huawei.com>
      Acked-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      4c3c796a
    • Yuan Can's avatar
      NTB: amd: Fix error handling in amd_ntb_pci_driver_init() · 98af0a33
      Yuan Can authored
      
      
      A problem about ntb_hw_amd create debugfs failed is triggered with the
      following log given:
      
       [  618.431232] AMD(R) PCI-E Non-Transparent Bridge Driver 1.0
       [  618.433284] debugfs: Directory 'ntb_hw_amd' with parent '/' already present!
      
      The reason is that amd_ntb_pci_driver_init() returns pci_register_driver()
      directly without checking its return value, if pci_register_driver()
      failed, it returns without destroy the newly created debugfs, resulting
      the debugfs of ntb_hw_amd can never be created later.
      
       amd_ntb_pci_driver_init()
         debugfs_create_dir() # create debugfs directory
         pci_register_driver()
           driver_register()
             bus_add_driver()
               priv = kzalloc(...) # OOM happened
         # return without destroy debugfs directory
      
      Fix by removing debugfs when pci_register_driver() returns error.
      
      Fixes: a1b36958 ("NTB: Add support for AMD PCI-Express Non-Transparent Bridge")
      Signed-off-by: default avatarYuan Can <yuancan@huawei.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      98af0a33
    • Yuan Can's avatar
      ntb: idt: Fix error handling in idt_pci_driver_init() · c0129682
      Yuan Can authored
      
      
      A problem about ntb_hw_idt create debugfs failed is triggered with the
      following log given:
      
       [ 1236.637636] IDT PCI-E Non-Transparent Bridge Driver 2.0
       [ 1236.639292] debugfs: Directory 'ntb_hw_idt' with parent '/' already present!
      
      The reason is that idt_pci_driver_init() returns pci_register_driver()
      directly without checking its return value, if pci_register_driver()
      failed, it returns without destroy the newly created debugfs, resulting
      the debugfs of ntb_hw_idt can never be created later.
      
       idt_pci_driver_init()
         debugfs_create_dir() # create debugfs directory
         pci_register_driver()
           driver_register()
             bus_add_driver()
               priv = kzalloc(...) # OOM happened
         # return without destroy debugfs directory
      
      Fix by removing debugfs when pci_register_driver() returns error.
      
      Fixes: bf2a952d ("NTB: Add IDT 89HPESxNTx PCIe-switches support")
      Signed-off-by: default avatarYuan Can <yuancan@huawei.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      c0129682
  2. Jun 26, 2023
  3. Jun 24, 2023
  4. Jun 23, 2023
  5. Jun 22, 2023
    • Qu Wenruo's avatar
      btrfs: fix remaining u32 overflows when left shifting stripe_nr · cb091225
      Qu Wenruo authored
      There was regression caused by a97699d1 ("btrfs: replace
      map_lookup->stripe_len by BTRFS_STRIPE_LEN") and supposedly fixed by
      a7299a18 ("btrfs: fix u32 overflows when left shifting stripe_nr").
      To avoid code churn the fix was open coding the type casts but
      unfortunately missed one which was still possible to hit [1].
      
      The missing place was assignment of bioc->full_stripe_logical inside
      btrfs_map_block().
      
      Fix it by adding a helper that does the safe calculation of the offset
      and use it everywhere even though it may not be strictly necessary due
      to already using u64 types.  This replaces all remaining
      "<< BTRFS_STRIPE_LEN_SHIFT" calls.
      
      [1] https://lore.kernel.org/linux-btrfs/20230622065438.86402-1-wqu@suse.com/
      
      
      
      Fixes: a7299a18 ("btrfs: fix u32 overflows when left shifting stripe_nr")
      Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      [ update changelog ]
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      cb091225
    • Ming Lei's avatar
      block: make sure local irq is disabled when calling __blkcg_rstat_flush · 9c39b7a9
      Ming Lei authored
      
      
      When __blkcg_rstat_flush() is called from cgroup_rstat_flush*() code
      path, interrupt is always disabled.
      
      When we start to flush blkcg per-cpu stats list in __blkg_release()
      for avoiding to leak blkcg_gq's reference in commit 20cb1c2f
      ("blk-cgroup: Flush stats before releasing blkcg_gq"), local irq
      isn't disabled yet, then lockdep warning may be triggered because
      the dependent cgroup locks may be acquired from irq(soft irq) handler.
      
      Fix the issue by disabling local irq always.
      
      Fixes: 20cb1c2f ("blk-cgroup: Flush stats before releasing blkcg_gq")
      Reported-by: default avatarShinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
      Closes: https://lore.kernel.org/linux-block/pz2wzwnmn5tk3pwpskmjhli6g3qly7eoknilb26of376c7kwxy@qydzpvt6zpis/T/#u
      
      
      Cc: stable@vger.kernel.org
      Cc: Jay Shin <jaeshin@redhat.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Waiman Long <longman@redhat.com>
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Reviewed-by: default avatarWaiman Long <longman@redhat.com>
      Link: https://lore.kernel.org/r/20230622084249.1208005-1-ming.lei@redhat.com
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      9c39b7a9
    • Paolo Abeni's avatar
      Merge tag 'nf-23-06-21' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf · 2ba7e7eb
      Paolo Abeni authored
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter/IPVS fixes for net
      
      This is v3, including a crash fix for patch 01/14.
      
      The following patchset contains Netfilter/IPVS fixes for net:
      
      1) Fix UDP segmentation with IPVS tunneled traffic, from Terin Stock.
      
      2) Fix chain binding transaction logic, add a bound flag to rule
         transactions. Remove incorrect logic in nft_data_hold() and
         nft_data_release().
      
      3) Add a NFT_TRANS_PREPARE_ERROR deactivate state to deal with releasing
         the set/chain as a follow up to 1240eb93 ("netfilter: nf_tables:
         incorrect error path handling with NFT_MSG_NEWRULE")
      
      4) Drop map element references from preparation phase instead of
         set destroy path, otherwise bogus EBUSY with transactions such as:
      
              flush chain ip x y
              delete chain ip x w
      
         where chain ip x y contains jump/goto from set elements.
      
      5) Pipapo set type does not regard generation mask from the walk
         iteration.
      
      6) Fix reference count underflow in set element reference to
         stateful object.
      
      7) Several patches to tighten the nf_tables API:
         - disallow set element updates of bound anonymous set
         - disallow unbound anonymous set/chain at the end of transaction.
         - disallow updates of anonymous set.
         - disallow timeout configuration for anonymous sets.
      
      8) Fix module reference leak in chain updates.
      
      9) Fix nfnetlink_osf module autoload.
      
      10) Fix deletion of basechain when NFTA_CHAIN_HOOK is specified as
          in iptables-nft.
      
      This Netfilter batch is larger than usual at this stage, I am aware we
      are fairly late in the -rc cycle, if you prefer to route them through
      net-next, please let me know.
      
      netfilter pull request 23-06-21
      
      * tag 'nf-23-06-21' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf:
        netfilter: nf_tables: Fix for deleting base chains with payload
        netfilter: nfnetlink_osf: fix module autoload
        netfilter: nf_tables: drop module reference after updating chain
        netfilter: nf_tables: disallow timeout for anonymous sets
        netfilter: nf_tables: disallow updates of anonymous sets
        netfilter: nf_tables: reject unbound chain set before commit phase
        netfilter: nf_tables: reject unbound anonymous set before commit phase
        netfilter: nf_tables: disallow element updates of bound anonymous sets
        netfilter: nf_tables: fix underflow in object reference counter
        netfilter: nft_set_pipapo: .walk does not deal with generations
        netfilter: nf_tables: drop map element references from preparation phase
        netfilter: nf_tables: add NFT_TRANS_PREPARE_ERROR to deal with bound set/chain
        netfilter: nf_tables: fix chain binding transaction logic
        ipvs: align inner_mac_header for encapsulation
      ====================
      
      Link: https://lore.kernel.org/r/20230621100731.68068-1-pablo@netfilter.org
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      2ba7e7eb