Skip to content
Snippets Groups Projects
  1. Feb 08, 2022
    • Jan Kara's avatar
      udf: Fix NULL ptr deref when converting from inline format · a23a5971
      Jan Kara authored
      
      commit 7fc3b7c2 upstream.
      
      udf_expand_file_adinicb() calls directly ->writepage to write data
      expanded into a page. This however misses to setup inode for writeback
      properly and so we can crash on inode->i_wb dereference when submitting
      page for IO like:
      
        BUG: kernel NULL pointer dereference, address: 0000000000000158
        #PF: supervisor read access in kernel mode
      ...
        <TASK>
        __folio_start_writeback+0x2ac/0x350
        __block_write_full_page+0x37d/0x490
        udf_expand_file_adinicb+0x255/0x400 [udf]
        udf_file_write_iter+0xbe/0x1b0 [udf]
        new_sync_write+0x125/0x1c0
        vfs_write+0x28e/0x400
      
      Fix the problem by marking the page dirty and going through the standard
      writeback path to write the page. Strictly speaking we would not even
      have to write the page but we want to catch e.g. ENOSPC errors early.
      
      Reported-by: default avatarbutt3rflyh4ck <butterflyhuangxx@gmail.com>
      CC: stable@vger.kernel.org
      Fixes: 52ebea74 ("writeback: make backing_dev_info host cgroup-specific bdi_writebacks")
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a23a5971
    • Jan Kara's avatar
      udf: Restore i_lenAlloc when inode expansion fails · 3740d41e
      Jan Kara authored
      
      commit ea856919 upstream.
      
      When we fail to expand inode from inline format to a normal format, we
      restore inode to contain the original inline formatting but we forgot to
      set i_lenAlloc back. The mismatch between i_lenAlloc and i_size was then
      causing further problems such as warnings and lost data down the line.
      
      Reported-by: default avatarbutt3rflyh4ck <butterflyhuangxx@gmail.com>
      CC: stable@vger.kernel.org
      Fixes: 7e49b6f2 ("udf: Convert UDF to new truncate calling sequence")
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3740d41e
    • Steffen Maier's avatar
      scsi: zfcp: Fix failed recovery on gone remote port with non-NPIV FCP devices · aff4a58b
      Steffen Maier authored
      commit 8c9db667 upstream.
      
      Suppose we have an environment with a number of non-NPIV FCP devices
      (virtual HBAs / FCP devices / zfcp "adapter"s) sharing the same physical
      FCP channel (HBA port) and its I_T nexus. Plus a number of storage target
      ports zoned to such shared channel. Now one target port logs out of the
      fabric causing an RSCN. Zfcp reacts with an ADISC ELS and subsequent port
      recovery depending on the ADISC result. This happens on all such FCP
      devices (in different Linux images) concurrently as they all receive a copy
      of this RSCN. In the following we look at one of those FCP devices.
      
      Requests other than FSF_QTCB_FCP_CMND can be slow until they get a
      response.
      
      Depending on which requests are affected by slow responses, there are
      different recovery outcomes. Here we want to fix failed recoveries on port
      or adapter level by avoiding recovery requests that can be slow.
      
      We need the cached N_Port_ID for the remote port "link" test with ADISC.
      Just before sending the ADISC, we now intentionally forget the old cached
      N_Port_ID. The idea is that on receiving an RSCN for a port, we have to
      assume that any cached information about this port is stale.  This forces a
      fresh new GID_PN [FC-GS] nameserver lookup on any subsequent recovery for
      the same port. Since we typically can still communicate with the nameserver
      efficiently, we now reach steady state quicker: Either the nameserver still
      does not know about the port so we stop recovery, or the nameserver already
      knows the port potentially with a new N_Port_ID and we can successfully and
      quickly perform open port recovery.  For the one case, where ADISC returns
      successfully, we re-initialize port->d_id because that case does not
      involve any port recovery.
      
      This also solves a problem if the storage WWPN quickly logs into the fabric
      again but with a different N_Port_ID. Such as on virtual WWPN takeover
      during target NPIV failover.
      [https://www.redbooks.ibm.com/abstracts/redp5477.html] In that case the
      RSCN from the storage FDISC was ignored by zfcp and we could not
      successfully recover the failover. On some later failback on the storage,
      we could have been lucky if the virtual WWPN got the same old N_Port_ID
      from the SAN switch as we still had cached.  Then the related RSCN
      triggered a successful port reopen recovery.  However, there is no
      guarantee to get the same N_Port_ID on NPIV FDISC.
      
      Even though NPIV-enabled FCP devices are not affected by this problem, this
      code change optimizes recovery time for gone remote ports as a side effect.
      The timely drop of cached N_Port_IDs prevents unnecessary slow open port
      attempts.
      
      While the problem might have been in code before v2.6.32 commit
      799b76d0 ("[SCSI] zfcp: Decouple gid_pn requests from erp") this fix
      depends on the gid_pn_work introduced with that commit, so we mark it as
      culprit to satisfy fix dependencies.
      
      Note: Point-to-point remote port is already handled separately and gets its
      N_Port_ID from the cached peer_d_id. So resetting port->d_id in general
      does not affect PtP.
      
      Link: https://lore.kernel.org/r/20220118165803.3667947-1-maier@linux.ibm.com
      
      
      Fixes: 799b76d0 ("[SCSI] zfcp: Decouple gid_pn requests from erp")
      Cc: <stable@vger.kernel.org> #2.6.32+
      Suggested-by: default avatarBenjamin Block <bblock@linux.ibm.com>
      Reviewed-by: default avatarBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: default avatarSteffen Maier <maier@linux.ibm.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aff4a58b
    • Vasily Gorbik's avatar
      s390/hypfs: include z/VM guests with access control group set · 9740a6bc
      Vasily Gorbik authored
      
      commit 663d34c8 upstream.
      
      Currently if z/VM guest is allowed to retrieve hypervisor performance
      data globally for all guests (privilege class B) the query is formed in a
      way to include all guests but the group name is left empty. This leads to
      that z/VM guests which have access control group set not being included
      in the results (even local vm).
      
      Change the query group identifier from empty to "any" to retrieve
      information about all guests from any groups (or without a group set).
      
      Cc: stable@vger.kernel.org
      Fixes: 31cb4bd3 ("[S390] Hypervisor filesystem (s390_hypfs) for z/VM")
      Reviewed-by: default avatarGerald Schaefer <gerald.schaefer@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9740a6bc
    • Brian Gix's avatar
      Bluetooth: refactor malicious adv data check · 8819f93c
      Brian Gix authored
      
      commit 899663be upstream.
      
      Check for out-of-bound read was being performed at the end of while
      num_reports loop, and would fill journal with false positives. Added
      check to beginning of loop processing so that it doesn't get checked
      after ptr has been advanced.
      
      Signed-off-by: default avatarBrian Gix <brian.gix@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Cc: syphyr <syphyr@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8819f93c
  2. Jan 29, 2022
  3. Jan 27, 2022
Loading