1. 09 12月, 2022 4 次提交
    • J
      udf: Fix extending file within last block · 1f3868f0
      Jan Kara 提交于
      When extending file within last block it can happen that the extent is
      already rounded to the blocksize and thus contains the offset we want to
      grow up to. In such case we would mistakenly expand the last extent and
      make it one block longer than it should be, exposing unallocated block
      in a file and causing data corruption. Fix the problem by properly
      detecting this case and bailing out.
      
      CC: stable@vger.kernel.org
      Signed-off-by: NJan Kara <jack@suse.cz>
      1f3868f0
    • J
      udf: Discard preallocation before extending file with a hole · 16d05565
      Jan Kara 提交于
      When extending file with a hole, we tried to preserve existing
      preallocation for the file. However that is not very useful and
      complicates code because the previous extent may need to be rounded to
      block boundary as well (which we forgot to do thus causing data
      corruption for sequence like:
      
      xfs_io -f -c "pwrite 0x75e63 11008" -c "truncate 0x7b24b" \
        -c "truncate 0xabaa3" -c "pwrite 0xac70b 22954" \
        -c "pwrite 0x93a43 11358" -c "pwrite 0xb8e65 52211" file
      
      with 512-byte block size. Just discard preallocation before extending
      file to simplify things and also fix this data corruption.
      
      CC: stable@vger.kernel.org
      Signed-off-by: NJan Kara <jack@suse.cz>
      16d05565
    • J
      udf: Do not bother looking for prealloc extents if i_lenExtents matches i_size · 6ad53f0f
      Jan Kara 提交于
      If rounded block-rounded i_lenExtents matches block rounded i_size,
      there are no preallocation extents. Do not bother walking extent linked
      list.
      
      CC: stable@vger.kernel.org
      Signed-off-by: NJan Kara <jack@suse.cz>
      6ad53f0f
    • J
      udf: Fix preallocation discarding at indirect extent boundary · cfe4c1b2
      Jan Kara 提交于
      When preallocation extent is the first one in the extent block, the
      code would corrupt extent tree header instead. Fix the problem and use
      udf_delete_aext() for deleting extent to avoid some code duplication.
      
      CC: stable@vger.kernel.org
      Signed-off-by: NJan Kara <jack@suse.cz>
      cfe4c1b2
  2. 05 12月, 2022 1 次提交
    • B
      udf: Increase UDF_MAX_READ_VERSION to 0x0260 · 7868f930
      Bartosz Taudul 提交于
      Some discs containing the UDF file system are unable to be mounted,
      failing with the following message:
      
        UDF-fs: error (device sr0): udf_fill_super: minUDFReadRev=260
          (max is 250)
      
      The UDF 2.60 specification [0] states in the section Basic Restrictions
      & Requirements (page 10):
      
        The Minimum UDF Read Revision value shall be at most #0250 for all
        media with a UDF 2.60 file system. This indicates that a UDF 2.50
        implementation can read all UDF 2.60 media. Media that do not have a
        Metadata Partition may use a value lower than #250.
      
      The conclusion is that the discs failing to mount were burned with a
      faulty software, which didn't follow the specification. This can be
      worked around by increasing UDF_MAX_READ_VERSION to 0x260, to match the
      Minimum Read Revision. No other changes are required, as reading UDF
      2.60 is backward compatible with UDF 2.50.
      
      [0] http://www.osta.org/specs/pdf/udf260.pdfSigned-off-by: NBartosz Taudul <wolf@nereid.pl>
      Signed-off-by: NJan Kara <jack@suse.cz>
      7868f930
  3. 28 11月, 2022 2 次提交
    • R
      fs/ext2: Fix code indentation · b41b98e1
      Rong Tao 提交于
      ts=4 can cause misunderstanding in code reading. It is better to replace
      8 spaces with one tab.
      Signed-off-by: NRong Tao <rongtao@cestc.cn>
      Signed-off-by: NJan Kara <jack@suse.cz>
      b41b98e1
    • A
      ext2: unbugger ext2_empty_dir() · 27e714c0
      Al Viro 提交于
      In 27cfa258 "ext2: fix fs corruption when trying to remove
      a non-empty directory with IO error" a funny thing has happened:
      
      -               page = ext2_get_page(inode, i, dir_has_error, &page_addr);
      +               page = ext2_get_page(inode, i, 0, &page_addr);
      
       -               if (IS_ERR(page)) {
       -                       dir_has_error = 1;
       -                       continue;
       -               }
       +               if (IS_ERR(page))
       +                       goto not_empty;
      
      And at not_empty: we hit ext2_put_page(page, page_addr), which does
      put_page(page).  Which, unless I'm very mistaken, should oops
      immediately when given ERR_PTR(-E...) as page.
      
      OK, shit happens, insufficiently tested patches included.  But when
      commit in question describes the fault-injection test that exercised
      that particular failure exit...
      
      Ow.
      
      CC: stable@vger.kernel.org
      Fixes: 27cfa258 ("ext2: fix fs corruption when trying to remove a non-empty directory with IO error")
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NJan Kara <jack@suse.cz>
      27e714c0
  4. 21 11月, 2022 3 次提交
  5. 11 11月, 2022 1 次提交
  6. 24 10月, 2022 2 次提交
    • S
      udf: Avoid double brelse() in udf_rename() · c791730f
      Shigeru Yoshida 提交于
      syzbot reported a warning like below [1]:
      
      VFS: brelse: Trying to free free buffer
      WARNING: CPU: 2 PID: 7301 at fs/buffer.c:1145 __brelse+0x67/0xa0
      ...
      Call Trace:
       <TASK>
       invalidate_bh_lru+0x99/0x150
       smp_call_function_many_cond+0xe2a/0x10c0
       ? generic_remap_file_range_prep+0x50/0x50
       ? __brelse+0xa0/0xa0
       ? __mutex_lock+0x21c/0x12d0
       ? smp_call_on_cpu+0x250/0x250
       ? rcu_read_lock_sched_held+0xb/0x60
       ? lock_release+0x587/0x810
       ? __brelse+0xa0/0xa0
       ? generic_remap_file_range_prep+0x50/0x50
       on_each_cpu_cond_mask+0x3c/0x80
       blkdev_flush_mapping+0x13a/0x2f0
       blkdev_put_whole+0xd3/0xf0
       blkdev_put+0x222/0x760
       deactivate_locked_super+0x96/0x160
       deactivate_super+0xda/0x100
       cleanup_mnt+0x222/0x3d0
       task_work_run+0x149/0x240
       ? task_work_cancel+0x30/0x30
       do_exit+0xb29/0x2a40
       ? reacquire_held_locks+0x4a0/0x4a0
       ? do_raw_spin_lock+0x12a/0x2b0
       ? mm_update_next_owner+0x7c0/0x7c0
       ? rwlock_bug.part.0+0x90/0x90
       ? zap_other_threads+0x234/0x2d0
       do_group_exit+0xd0/0x2a0
       __x64_sys_exit_group+0x3a/0x50
       do_syscall_64+0x34/0xb0
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      The cause of the issue is that brelse() is called on both ofibh.sbh
      and ofibh.ebh by udf_find_entry() when it returns NULL.  However,
      brelse() is called by udf_rename(), too.  So, b_count on buffer_head
      becomes unbalanced.
      
      This patch fixes the issue by not calling brelse() by udf_rename()
      when udf_find_entry() returns NULL.
      
      Link: https://syzkaller.appspot.com/bug?id=8297f45698159c6bca8a1f87dc983667c1a1c851 [1]
      Reported-by: syzbot+7902cd7684bc35306224@syzkaller.appspotmail.com
      Signed-off-by: NShigeru Yoshida <syoshida@redhat.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      Link: https://lore.kernel.org/r/20221023095741.271430-1-syoshida@redhat.com
      c791730f
    • L
      fs: udf: Optimize udf_free_in_core_inode and udf_find_fileset function · 0dafb7e6
      Li zeming 提交于
      These two functions perform the following optimizations.
      1. Delete the type cast of foo pointer. Void * does not need to convert
      the type.
      2. Delete the initialization assignment of bh variable, which is
      assigned first.
      Signed-off-by: NLi zeming <zeming@nfschina.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      Link: https://lore.kernel.org/r/20221012104235.3331-1-zeming@nfschina.com
      0dafb7e6
  7. 21 10月, 2022 4 次提交
  8. 20 10月, 2022 3 次提交
    • S
      cifs: update internal module number · 73b1b8d2
      Steve French 提交于
      To 2.40
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      73b1b8d2
    • P
      cifs: fix memory leaks in session setup · 01f2ee7e
      Paulo Alcantara 提交于
      We were only zeroing out the ntlmssp blob but forgot to free the
      allocated buffer in the end of SMB2_sess_auth_rawntlmssp_negotiate()
      and SMB2_sess_auth_rawntlmssp_authenticate() functions.
      
      This fixes below kmemleak reports:
      
      unreferenced object 0xffff88800ddcfc60 (size 96):
        comm "mount.cifs", pid 758, jiffies 4294696066 (age 42.967s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<00000000d0beeb29>] __kmalloc+0x39/0xa0
          [<00000000e3834047>] build_ntlmssp_smb3_negotiate_blob+0x2c/0x110 [cifs]
          [<00000000e85f5ab2>] SMB2_sess_auth_rawntlmssp_negotiate+0xd3/0x230 [cifs]
          [<0000000080fdb897>] SMB2_sess_setup+0x16c/0x2a0 [cifs]
          [<000000009af320a8>] cifs_setup_session+0x13b/0x370 [cifs]
          [<00000000f15d5982>] cifs_get_smb_ses+0x643/0xb90 [cifs]
          [<00000000fe15eb90>] mount_get_conns+0x63/0x3e0 [cifs]
          [<00000000768aba03>] mount_get_dfs_conns+0x16/0xa0 [cifs]
          [<00000000cf1cf146>] cifs_mount+0x1c2/0x9a0 [cifs]
          [<000000000d66b51e>] cifs_smb3_do_mount+0x10e/0x710 [cifs]
          [<0000000077a996c5>] smb3_get_tree+0xf4/0x200 [cifs]
          [<0000000094dbd041>] vfs_get_tree+0x23/0xc0
          [<000000003a8561de>] path_mount+0x2d3/0xb50
          [<00000000ed5c86d6>] __x64_sys_mount+0x102/0x140
          [<00000000142142f3>] do_syscall_64+0x3b/0x90
          [<00000000e2b89731>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
      unreferenced object 0xffff88801437f000 (size 512):
        comm "mount.cifs", pid 758, jiffies 4294696067 (age 42.970s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<00000000d0beeb29>] __kmalloc+0x39/0xa0
          [<00000000004f53d2>] build_ntlmssp_auth_blob+0x4f/0x340 [cifs]
          [<000000005f333084>] SMB2_sess_auth_rawntlmssp_authenticate+0xd4/0x250 [cifs]
          [<0000000080fdb897>] SMB2_sess_setup+0x16c/0x2a0 [cifs]
          [<000000009af320a8>] cifs_setup_session+0x13b/0x370 [cifs]
          [<00000000f15d5982>] cifs_get_smb_ses+0x643/0xb90 [cifs]
          [<00000000fe15eb90>] mount_get_conns+0x63/0x3e0 [cifs]
          [<00000000768aba03>] mount_get_dfs_conns+0x16/0xa0 [cifs]
          [<00000000cf1cf146>] cifs_mount+0x1c2/0x9a0 [cifs]
          [<000000000d66b51e>] cifs_smb3_do_mount+0x10e/0x710 [cifs]
          [<0000000077a996c5>] smb3_get_tree+0xf4/0x200 [cifs]
          [<0000000094dbd041>] vfs_get_tree+0x23/0xc0
          [<000000003a8561de>] path_mount+0x2d3/0xb50
          [<00000000ed5c86d6>] __x64_sys_mount+0x102/0x140
          [<00000000142142f3>] do_syscall_64+0x3b/0x90
          [<00000000e2b89731>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Fixes: a4e430c8 ("cifs: replace kfree() with kfree_sensitive() for sensitive data")
      Signed-off-by: NPaulo Alcantara (SUSE) <pc@cjr.nz>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      01f2ee7e
    • R
      cifs: drop the lease for cached directories on rmdir or rename · 8e77860c
      Ronnie Sahlberg 提交于
      When we delete or rename a directory we must also drop any cached lease we have
      on the directory.
      
      Fixes: a350d6e73f5e ("cifs: enable caching of directories for which a lease is held")
      Reviewed-by: NPaulo Alcantara (SUSE) <pc@cjr.nz>
      Signed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      8e77860c
  9. 19 10月, 2022 9 次提交
  10. 17 10月, 2022 4 次提交
  11. 15 10月, 2022 6 次提交
  12. 14 10月, 2022 1 次提交