<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/fs/ext2/xattr.c, branch linux-6.12.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-6.12.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-6.12.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2024-01-23T18:21:11+00:00</updated>
<entry>
<title>ext2: Remove GFP_NOFS use in ext2_xattr_cache_insert()</title>
<updated>2024-01-23T18:21:11+00:00</updated>
<author>
<name>Jan Kara</name>
<email>jack@suse.cz</email>
</author>
<published>2024-01-09T11:27:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c3e637c7f0c9aea051b3e49fc243ad83e19348c6'/>
<id>urn:sha1:c3e637c7f0c9aea051b3e49fc243ad83e19348c6</id>
<content type='text'>
ext2_xattr_cache_insert() calls mb_cache_entry_create() with GFP_NOFS
because it is called under EXT2_I(inode)-&gt;xattr_sem. However xattr_sem
or any higher ranking lock is not acquired on fs reclaim path for ext2
at least since we don't do page writeback from direct reclaim.  Thus
GFP_NOFS is not needed.

Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
</content>
</entry>
<entry>
<title>ext2: move ext2_xattr_handlers and ext2_xattr_handler_map to .rodata</title>
<updated>2023-10-09T14:24:18+00:00</updated>
<author>
<name>Wedson Almeida Filho</name>
<email>walmeida@microsoft.com</email>
</author>
<published>2023-09-30T05:00:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ce78a1ec1c3b58992112c80ccb0831b91b7b313a'/>
<id>urn:sha1:ce78a1ec1c3b58992112c80ccb0831b91b7b313a</id>
<content type='text'>
This makes it harder for accidental or malicious changes to
ext2_xattr_handlers or ext2_xattr_handler_map at runtime.

Cc: Jan Kara &lt;jack@suse.com&gt;
Cc: linux-ext4@vger.kernel.org
Signed-off-by: Wedson Almeida Filho &lt;walmeida@microsoft.com&gt;
Link: https://lore.kernel.org/r/20230930050033.41174-10-wedsonaf@gmail.com
Acked-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'for_v6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs</title>
<updated>2023-08-30T19:10:50+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2023-08-30T19:10:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1500e7e0726e963f64b9785a0cb0a820b2587bad'/>
<id>urn:sha1:1500e7e0726e963f64b9785a0cb0a820b2587bad</id>
<content type='text'>
Pull ext2, quota, and udf updates from Jan Kara:

 - fixes for possible use-after-free issues with quota when racing with
   chown

 - fixes for ext2 crashing when xattr allocation races with another
   block allocation to the same file from page writeback code

 - fix for block number overflow in ext2

 - marking of reiserfs as obsolete in MAINTAINERS

 - assorted minor cleanups

* tag 'for_v6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  ext2: Fix kernel-doc warnings
  ext2: improve consistency of ext2_fsblk_t datatype usage
  ext2: dump current reservation window info
  ext2: fix race between setxattr and write back
  ext2: introduce new flags argument for ext2_new_blocks()
  ext2: remove ext2_new_block()
  ext2: fix datatype of block number in ext2_xattr_set2()
  udf: Drop pointless aops assignment
  quota: use lockdep_assert_held_write in dquot_load_quota_sb
  MAINTAINERS: change reiserfs status to obsolete
  udf: Fix -Wstringop-overflow warnings
  quota: simplify drop_dquot_ref()
  quota: fix dqput() to follow the guarantees dquot_srcu should provide
  quota: add new helper dquot_active()
  quota: rename dquot_active() to inode_quota_active()
  quota: factor out dquot_write_dquot()
  ext2: remove redundant assignment to variable desc and variable best_desc
</content>
</entry>
<entry>
<title>ext2: fix race between setxattr and write back</title>
<updated>2023-08-16T15:47:37+00:00</updated>
<author>
<name>Ye Bin</name>
<email>yebin10@huawei.com</email>
</author>
<published>2023-08-15T11:26:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=83f99de1b7c0dcfa42b211e5e40334b7ad786b36'/>
<id>urn:sha1:83f99de1b7c0dcfa42b211e5e40334b7ad786b36</id>
<content type='text'>
There's an issue when allocating xattrs as follows:
Block Allocation Reservation Windows Map (ext2_try_to_allocate_with_rsv):
reservation window 0x000000006f105382 start: 0, end: 0
reservation window 0x000000008fd1a555 start: 1044, end: 1059
Window map complete.
kernel BUG at fs/ext2/balloc.c:1158!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
RIP: 0010:ext2_try_to_allocate_with_rsv.isra.0+0x15c4/0x1800
Call Trace:
 &lt;TASK&gt;
 ext2_new_blocks+0x935/0x1690
 ext2_new_block+0x73/0xa0
 ext2_xattr_set2+0x74f/0x1730
 ext2_xattr_set+0x12b6/0x2260
 ext2_xattr_user_set+0x9c/0x110
 __vfs_setxattr+0x139/0x1d0
 __vfs_setxattr_noperm+0xfc/0x370
 __vfs_setxattr_locked+0x205/0x2c0
 vfs_setxattr+0x19d/0x3b0
 do_setxattr+0xff/0x220
 setxattr+0x123/0x150
 path_setxattr+0x193/0x1e0
 __x64_sys_setxattr+0xc8/0x170
 do_syscall_64+0x35/0x80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Above issue may happens as follows:
        setxattr                             write back
ext2_xattr_set
  ext2_xattr_set2
    ext2_new_block
      ext2_new_blocks
        ext2_try_to_allocate_with_rsv
          alloc_new_reservation
          --&gt; group=0 [0, 1023] rsv [1016, 1023]
                                        do_writepages
                                          mpage_writepages
                                            write_cache_pages
                                              __mpage_writepage
                                                ext2_get_block
                                                  ext2_get_blocks
                                                   ext2_alloc_branch
                                                    ext2_new_blocks
                                                     ext2_try_to_allocate_with_rsv
                                                       alloc_new_reservation
                                     --&gt;group=1 [1024, 2047] rsv [1044, 1059]
          if ((my_rsv-&gt;rsv_start &gt; group_last_block) ||
              (my_rsv-&gt;rsv_end &lt; group_first_block)
              rsv_window_dump
              BUG();

Now ext2 mkwrite doesn't allocate new blocks so for these cases we may
be allocating blocks during writeback. However, there is no protection
between ext2_xattr_set() and do_writepages() so these two functions can
conflict on handling the reservation window.  To solve about issue don't
use the reservation window when allocating block for xattr.

Signed-off-by: Ye Bin &lt;yebin10@huawei.com&gt;
Message-Id: &lt;20230815112612.221145-4-yebin10@huawei.com&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
</content>
</entry>
<entry>
<title>ext2: introduce new flags argument for ext2_new_blocks()</title>
<updated>2023-08-16T15:42:42+00:00</updated>
<author>
<name>Ye Bin</name>
<email>yebin10@huawei.com</email>
</author>
<published>2023-08-15T11:26:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b450159d0903b06ebea121a010ab9c424b67c408'/>
<id>urn:sha1:b450159d0903b06ebea121a010ab9c424b67c408</id>
<content type='text'>
This patch introduces a new flags argument for ext2_new_blocks() and also
a new EXT2_ALLOC_NORESERVE flag.

Signed-off-by: Ye Bin &lt;yebin10@huawei.com&gt;
Message-Id: &lt;20230815112612.221145-3-yebin10@huawei.com&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
</content>
</entry>
<entry>
<title>ext2: remove ext2_new_block()</title>
<updated>2023-08-16T15:35:08+00:00</updated>
<author>
<name>Ye Bin</name>
<email>yebin10@huawei.com</email>
</author>
<published>2023-08-15T11:26:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2445a8a1922b46c56189203f7fdc1e1cb2a47cdd'/>
<id>urn:sha1:2445a8a1922b46c56189203f7fdc1e1cb2a47cdd</id>
<content type='text'>
Now, only xattr allocate block use ext2_new_block(), so just opencode it in
the xattr code.

Signed-off-by: Ye Bin &lt;yebin10@huawei.com&gt;
Message-Id: &lt;20230815112612.221145-2-yebin10@huawei.com&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
</content>
</entry>
<entry>
<title>ext2: fix datatype of block number in ext2_xattr_set2()</title>
<updated>2023-08-16T14:09:45+00:00</updated>
<author>
<name>Georg Ottinger</name>
<email>g.ottinger@gmx.at</email>
</author>
<published>2023-08-15T10:03:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e88076348425b7d0491c8c98d8732a7df8de7aa3'/>
<id>urn:sha1:e88076348425b7d0491c8c98d8732a7df8de7aa3</id>
<content type='text'>
I run a small server that uses external hard drives for backups. The
backup software I use uses ext2 filesystems with 4KiB block size and
the server is running SELinux and therefore relies on xattr. I recently
upgraded the hard drives from 4TB to 12TB models. I noticed that after
transferring some TBs I got a filesystem error "Freeing blocks not in
datazone - block = 18446744071529317386, count = 1" and the backup
process stopped. Trying to fix the fs with e2fsck resulted in a
completely corrupted fs. The error probably came from ext2_free_blocks(),
and because of the large number 18e19 this problem immediately looked
like some kind of integer overflow. Whereas the 4TB fs was about 1e9
blocks, the new 12TB is about 3e9 blocks. So, searching the ext2 code,
I came across the line in fs/ext2/xattr.c:745 where ext2_new_block()
is called and the resulting block number is stored in the variable block
as an int datatype. If a block with a block number greater than
INT32_MAX is returned, this variable overflows and the call to
sb_getblk() at line fs/ext2/xattr.c:750 fails, then the call to
ext2_free_blocks() produces the error.

Signed-off-by: Georg Ottinger &lt;g.ottinger@gmx.at&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Message-Id: &lt;20230815100340.22121-1-g.ottinger@gmx.at&gt;
</content>
</entry>
<entry>
<title>ext2: convert to ctime accessor functions</title>
<updated>2023-07-13T08:28:07+00:00</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@kernel.org</email>
</author>
<published>2023-07-05T19:01:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fc4eed640d8f124dfc47ead69232f570a310496a'/>
<id>urn:sha1:fc4eed640d8f124dfc47ead69232f570a310496a</id>
<content type='text'>
In later patches, we're going to change how the inode's ctime field is
used. Switch to using accessor functions instead of raw accesses of
inode-&gt;i_ctime.

Signed-off-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Reviewed-by: Jan Kara &lt;jack@suse.cz&gt;
Message-Id: &lt;20230705190309.579783-39-jlayton@kernel.org&gt;
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'fs_for_v6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs</title>
<updated>2023-04-26T16:07:46+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2023-04-26T16:07:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=94fc0792661a96d64a4bb79cf10d0793ecadf76e'/>
<id>urn:sha1:94fc0792661a96d64a4bb79cf10d0793ecadf76e</id>
<content type='text'>
Pull ext2, reiserfs, udf, and quota updates from Jan Kara:
 "A couple of small fixes and cleanups for ext2, udf, reiserfs, and
  quota.

  The biggest change is making CONFIG_PRINT_QUOTA_WARNING depend on
  BROKEN with an outlook for removing it completely in an year or so"

* tag 'fs_for_v6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  quota: mark PRINT_QUOTA_WARNING as BROKEN
  quota: update Kconfig comment
  reiserfs: remove unused iter variable
  quota: Use register_sysctl_init() for registering fs_dqstats_table
  reiserfs: remove unused sched_count variable
  ext2: remove redundant assignment to pointer end
  quota: make dquot_set_dqinfo return errors from -&gt;write_info
  quota: fixup *_write_file_info() to return proper error code
  quota: simplify two-level sysctl registration for fs_dqstats_table
  udf: use wrapper i_blocksize() in udf_discard_prealloc()
  udf: Use folios in udf_adinicb_writepage()
  ext2: Check block size validity during mount
  ext2: Correct maximum ext2 filesystem block size
</content>
</entry>
<entry>
<title>ext2: remove redundant assignment to pointer end</title>
<updated>2023-03-21T14:06:06+00:00</updated>
<author>
<name>Colin Ian King</name>
<email>colin.i.king@gmail.com</email>
</author>
<published>2023-03-17T14:34:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fae0a2b2077c30f567b6b32c2467e7dda8e1d270'/>
<id>urn:sha1:fae0a2b2077c30f567b6b32c2467e7dda8e1d270</id>
<content type='text'>
Pointer is assigned a value that is never read, the assignment is
redundant and can be removed.

Cleans up clang-scan warning:
fs/ext2/xattr.c:555:3: warning: Value stored to 'end' is never read [deadcode.DeadStores]
                end = (char *)header + sb-&gt;s_blocksize;

Signed-off-by: Colin Ian King &lt;colin.i.king@gmail.com&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Message-Id: &lt;20230317143420.419005-1-colin.i.king@gmail.com&gt;
</content>
</entry>
</feed>
