<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/fs, branch v5.9</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.9</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.9'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2020-10-11T18:11:35Z</updated>
<entry>
<title>Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs</title>
<updated>2020-10-11T18:11:35Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-10-11T18:11:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5b697f86f9f136d200c9827d6eca0437b7eb96cf'/>
<id>urn:sha1:5b697f86f9f136d200c9827d6eca0437b7eb96cf</id>
<content type='text'>
Pull vfs fix from Al Viro:
 "Fixes an obvious bug (memory leak introduced in 5.8)"

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  pipe: Fix memory leaks in create_pipe_files()
</content>
</entry>
<entry>
<title>cifs: Fix incomplete memory allocation on setxattr path</title>
<updated>2020-10-10T22:52:54Z</updated>
<author>
<name>Vladimir Zapolskiy</name>
<email>vladimir@tuxera.com</email>
</author>
<published>2020-10-10T18:25:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=64b7f674c292207624b3d788eda2dde3dc1415df'/>
<id>urn:sha1:64b7f674c292207624b3d788eda2dde3dc1415df</id>
<content type='text'>
On setxattr() syscall path due to an apprent typo the size of a dynamically
allocated memory chunk for storing struct smb2_file_full_ea_info object is
computed incorrectly, to be more precise the first addend is the size of
a pointer instead of the wanted object size. Coincidentally it makes no
difference on 64-bit platforms, however on 32-bit targets the following
memcpy() writes 4 bytes of data outside of the dynamically allocated memory.

  =============================================================================
  BUG kmalloc-16 (Not tainted): Redzone overwritten
  -----------------------------------------------------------------------------

  Disabling lock debugging due to kernel taint
  INFO: 0x79e69a6f-0x9e5cdecf @offset=368. First byte 0x73 instead of 0xcc
  INFO: Slab 0xd36d2454 objects=85 used=51 fp=0xf7d0fc7a flags=0x35000201
  INFO: Object 0x6f171df3 @offset=352 fp=0x00000000

  Redzone 5d4ff02d: cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc  ................
  Object 6f171df3: 00 00 00 00 00 05 06 00 73 6e 72 75 62 00 66 69  ........snrub.fi
  Redzone 79e69a6f: 73 68 32 0a                                      sh2.
  Padding 56254d82: 5a 5a 5a 5a 5a 5a 5a 5a                          ZZZZZZZZ
  CPU: 0 PID: 8196 Comm: attr Tainted: G    B             5.9.0-rc8+ #3
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1 04/01/2014
  Call Trace:
   dump_stack+0x54/0x6e
   print_trailer+0x12c/0x134
   check_bytes_and_report.cold+0x3e/0x69
   check_object+0x18c/0x250
   free_debug_processing+0xfe/0x230
   __slab_free+0x1c0/0x300
   kfree+0x1d3/0x220
   smb2_set_ea+0x27d/0x540
   cifs_xattr_set+0x57f/0x620
   __vfs_setxattr+0x4e/0x60
   __vfs_setxattr_noperm+0x4e/0x100
   __vfs_setxattr_locked+0xae/0xd0
   vfs_setxattr+0x4e/0xe0
   setxattr+0x12c/0x1a0
   path_setxattr+0xa4/0xc0
   __ia32_sys_lsetxattr+0x1d/0x20
   __do_fast_syscall_32+0x40/0x70
   do_fast_syscall_32+0x29/0x60
   do_SYSENTER_32+0x15/0x20
   entry_SYSENTER_32+0x9f/0xf2

Fixes: 5517554e4313 ("cifs: Add support for writing attributes on SMB2+")
Signed-off-by: Vladimir Zapolskiy &lt;vladimir@tuxera.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'exfat-for-5.9-rc9' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat</title>
<updated>2020-10-08T18:10:13Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-10-08T18:10:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b9e3aa2a9bd49860ec5a9129fb522b0addc7d05b'/>
<id>urn:sha1:b9e3aa2a9bd49860ec5a9129fb522b0addc7d05b</id>
<content type='text'>
Pull exfat fixes from Namjae Jeon:

 - Fix use of uninitialized spinlock on error path

 - Fix missing err assignment in exfat_build_inode()

* tag 'exfat-for-5.9-rc9' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat:
  exfat: fix use of uninitialized spinlock on error path
  exfat: fix pointer error checking
</content>
</entry>
<entry>
<title>afs: Fix deadlock between writeback and truncate</title>
<updated>2020-10-08T17:50:55Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2020-10-07T13:22:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ec0fa0b659144d9c68204d23f627b6a65fa53e50'/>
<id>urn:sha1:ec0fa0b659144d9c68204d23f627b6a65fa53e50</id>
<content type='text'>
The afs filesystem has a lock[*] that it uses to serialise I/O operations
going to the server (vnode-&gt;io_lock), as the server will only perform one
modification operation at a time on any given file or directory.  This
prevents the the filesystem from filling up all the call slots to a server
with calls that aren't going to be executed in parallel anyway, thereby
allowing operations on other files to obtain slots.

  [*] Note that is probably redundant for directories at least since
      i_rwsem is used to serialise directory modifications and
      lookup/reading vs modification.  The server does allow parallel
      non-modification ops, however.

When a file truncation op completes, we truncate the in-memory copy of the
file to match - but we do it whilst still holding the io_lock, the idea
being to prevent races with other operations.

However, if writeback starts in a worker thread simultaneously with
truncation (whilst notify_change() is called with i_rwsem locked, writeback
pays it no heed), it may manage to set PG_writeback bits on the pages that
will get truncated before afs_setattr_success() manages to call
truncate_pagecache().  Truncate will then wait for those pages - whilst
still inside io_lock:

    # cat /proc/8837/stack
    [&lt;0&gt;] wait_on_page_bit_common+0x184/0x1e7
    [&lt;0&gt;] truncate_inode_pages_range+0x37f/0x3eb
    [&lt;0&gt;] truncate_pagecache+0x3c/0x53
    [&lt;0&gt;] afs_setattr_success+0x4d/0x6e
    [&lt;0&gt;] afs_wait_for_operation+0xd8/0x169
    [&lt;0&gt;] afs_do_sync_operation+0x16/0x1f
    [&lt;0&gt;] afs_setattr+0x1fb/0x25d
    [&lt;0&gt;] notify_change+0x2cf/0x3c4
    [&lt;0&gt;] do_truncate+0x7f/0xb2
    [&lt;0&gt;] do_sys_ftruncate+0xd1/0x104
    [&lt;0&gt;] do_syscall_64+0x2d/0x3a
    [&lt;0&gt;] entry_SYSCALL_64_after_hwframe+0x44/0xa9

The writeback operation, however, stalls indefinitely because it needs to
get the io_lock to proceed:

    # cat /proc/5940/stack
    [&lt;0&gt;] afs_get_io_locks+0x58/0x1ae
    [&lt;0&gt;] afs_begin_vnode_operation+0xc7/0xd1
    [&lt;0&gt;] afs_store_data+0x1b2/0x2a3
    [&lt;0&gt;] afs_write_back_from_locked_page+0x418/0x57c
    [&lt;0&gt;] afs_writepages_region+0x196/0x224
    [&lt;0&gt;] afs_writepages+0x74/0x156
    [&lt;0&gt;] do_writepages+0x2d/0x56
    [&lt;0&gt;] __writeback_single_inode+0x84/0x207
    [&lt;0&gt;] writeback_sb_inodes+0x238/0x3cf
    [&lt;0&gt;] __writeback_inodes_wb+0x68/0x9f
    [&lt;0&gt;] wb_writeback+0x145/0x26c
    [&lt;0&gt;] wb_do_writeback+0x16a/0x194
    [&lt;0&gt;] wb_workfn+0x74/0x177
    [&lt;0&gt;] process_one_work+0x174/0x264
    [&lt;0&gt;] worker_thread+0x117/0x1b9
    [&lt;0&gt;] kthread+0xec/0xf1
    [&lt;0&gt;] ret_from_fork+0x1f/0x30

and thus deadlock has occurred.

Note that whilst afs_setattr() calls filemap_write_and_wait(), the fact
that the caller is holding i_rwsem doesn't preclude more pages being
dirtied through an mmap'd region.

Fix this by:

 (1) Use the vnode validate_lock to mediate access between afs_setattr()
     and afs_writepages():

     (a) Exclusively lock validate_lock in afs_setattr() around the whole
     	 RPC operation.

     (b) If WB_SYNC_ALL isn't set on entry to afs_writepages(), trying to
     	 shared-lock validate_lock and returning immediately if we couldn't
     	 get it.

     (c) If WB_SYNC_ALL is set, wait for the lock.

     The validate_lock is also used to validate a file and to zap its cache
     if the file was altered by a third party, so it's probably a good fit
     for this.

 (2) Move the truncation outside of the io_lock in setattr, using the same
     hook as is used for local directory editing.

     This requires the old i_size to be retained in the operation record as
     we commit the revised status to the inode members inside the io_lock
     still, but we still need to know if we reduced the file size.

Fixes: d2ddc776a458 ("afs: Overhaul volume and server record caching and fileserver rotation")
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>exfat: fix use of uninitialized spinlock on error path</title>
<updated>2020-10-07T05:27:13Z</updated>
<author>
<name>Namjae Jeon</name>
<email>namjae.jeon@samsung.com</email>
</author>
<published>2020-09-29T00:09:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8ff006e57ad3a25f909c456d053aa498b6673a39'/>
<id>urn:sha1:8ff006e57ad3a25f909c456d053aa498b6673a39</id>
<content type='text'>
syzbot reported warning message:

Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1d6/0x29e lib/dump_stack.c:118
 register_lock_class+0xf06/0x1520 kernel/locking/lockdep.c:893
 __lock_acquire+0xfd/0x2ae0 kernel/locking/lockdep.c:4320
 lock_acquire+0x148/0x720 kernel/locking/lockdep.c:5029
 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
 _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151
 spin_lock include/linux/spinlock.h:354 [inline]
 exfat_cache_inval_inode+0x30/0x280 fs/exfat/cache.c:226
 exfat_evict_inode+0x124/0x270 fs/exfat/inode.c:660
 evict+0x2bb/0x6d0 fs/inode.c:576
 exfat_fill_super+0x1e07/0x27d0 fs/exfat/super.c:681
 get_tree_bdev+0x3e9/0x5f0 fs/super.c:1342
 vfs_get_tree+0x88/0x270 fs/super.c:1547
 do_new_mount fs/namespace.c:2875 [inline]
 path_mount+0x179d/0x29e0 fs/namespace.c:3192
 do_mount fs/namespace.c:3205 [inline]
 __do_sys_mount fs/namespace.c:3413 [inline]
 __se_sys_mount+0x126/0x180 fs/namespace.c:3390
 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

If exfat_read_root() returns an error, spinlock is used in
exfat_evict_inode() without initialization. This patch combines
exfat_cache_init_inode() with exfat_inode_init_once() to initialize
spinlock by slab constructor.

Fixes: c35b6810c495 ("exfat: add exfat cache")
Cc: stable@vger.kernel.org # v5.7+
Reported-by: syzbot &lt;syzbot+b91107320911a26c9a95@syzkaller.appspotmail.com&gt;
Signed-off-by: Namjae Jeon &lt;namjae.jeon@samsung.com&gt;
</content>
</entry>
<entry>
<title>exfat: fix pointer error checking</title>
<updated>2020-10-07T05:26:55Z</updated>
<author>
<name>Tetsuhiro Kohada</name>
<email>kohada.t2@gmail.com</email>
</author>
<published>2020-08-26T01:18:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d6c9efd92443b23307995f34246c2374056ebbd8'/>
<id>urn:sha1:d6c9efd92443b23307995f34246c2374056ebbd8</id>
<content type='text'>
Fix missing result check of exfat_build_inode().
And use PTR_ERR_OR_ZERO instead of PTR_ERR.

Signed-off-by: Tetsuhiro Kohada &lt;kohada.t2@gmail.com&gt;
Signed-off-by: Namjae Jeon &lt;namjae.jeon@samsung.com&gt;
</content>
</entry>
<entry>
<title>splice: teach splice pipe reading about empty pipe buffers</title>
<updated>2020-10-06T17:27:22Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-10-05T18:26:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d1a819a2ec2d3b5e6a8f8a9f67386bda0ad315bc'/>
<id>urn:sha1:d1a819a2ec2d3b5e6a8f8a9f67386bda0ad315bc</id>
<content type='text'>
Tetsuo Handa reports that splice() can return 0 before the real EOF, if
the data in the splice source pipe is an empty pipe buffer.  That empty
pipe buffer case doesn't happen in any normal situation, but you can
trigger it by doing a write to a pipe that fails due to a page fault.

Tetsuo has a test-case to show the behavior:

  #define _GNU_SOURCE
  #include &lt;sys/types.h&gt;
  #include &lt;sys/stat.h&gt;
  #include &lt;fcntl.h&gt;
  #include &lt;unistd.h&gt;

  int main(int argc, char *argv[])
  {
	const int fd = open("/tmp/testfile", O_WRONLY | O_CREAT, 0600);
	int pipe_fd[2] = { -1, -1 };
	pipe(pipe_fd);
	write(pipe_fd[1], NULL, 4096);
	/* This splice() should wait unless interrupted. */
	return !splice(pipe_fd[0], NULL, fd, NULL, 65536, 0);
  }

which results in

    write(5, NULL, 4096)                    = -1 EFAULT (Bad address)
    splice(4, NULL, 3, NULL, 65536, 0)      = 0

and this can confuse splice() users into believing they have hit EOF
prematurely.

The issue was introduced when the pipe write code started pre-allocating
the pipe buffers before copying data from user space.

This is modified verion of Tetsuo's original patch.

Fixes: a194dfe6e6f6 ("pipe: Rearrange sequence in pipe_write() to preallocate slot")
Link:https://lore.kernel.org/linux-fsdevel/20201005121339.4063-1-penguin-kernel@I-love.SAKURA.ne.jp/
Reported-by: Tetsuo Handa &lt;penguin-kernel@i-love.sakura.ne.jp&gt;
Acked-by: Tetsuo Handa &lt;penguin-kernel@i-love.sakura.ne.jp&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'io_uring-5.9-2020-10-02' of git://git.kernel.dk/linux-block</title>
<updated>2020-10-02T21:38:10Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-10-02T21:38:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=702bfc891db162b99e880da78cc256dac14cfc7f'/>
<id>urn:sha1:702bfc891db162b99e880da78cc256dac14cfc7f</id>
<content type='text'>
Pull io_uring fixes from Jens Axboe:

 - fix for async buffered reads if read-ahead is fully disabled (Hao)

 - double poll match fix

 - -&gt;show_fdinfo() potential ABBA deadlock complaint fix

* tag 'io_uring-5.9-2020-10-02' of git://git.kernel.dk/linux-block:
  io_uring: fix async buffered reads when readahead is disabled
  io_uring: fix potential ABBA deadlock in -&gt;show_fdinfo()
  io_uring: always delete double poll wait entry on match
</content>
</entry>
<entry>
<title>Merge branch 'work.epoll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs</title>
<updated>2020-10-02T17:37:08Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-10-02T17:37:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d4fce2e20ffed59eb5db7780fcbbb0a21decef74'/>
<id>urn:sha1:d4fce2e20ffed59eb5db7780fcbbb0a21decef74</id>
<content type='text'>
Pull epoll fixes from Al Viro:
 "Several race fixes in epoll"

* 'work.epoll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  ep_create_wakeup_source(): dentry name can change under you...
  epoll: EPOLL_CTL_ADD: close the race in decision to take fast path
  epoll: replace -&gt;visited/visited_list with generation count
  epoll: do not insert into poll queues until all sanity checks are done
</content>
</entry>
<entry>
<title>Merge tag 'for-5.9-rc7-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux</title>
<updated>2020-10-02T17:09:40Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-10-02T17:09:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4e3b9ce271b4b54d2293a3916d22e4ddc0c89aab'/>
<id>urn:sha1:4e3b9ce271b4b54d2293a3916d22e4ddc0c89aab</id>
<content type='text'>
Pull btrfs fixes from David Sterba:
 "Two more fixes.

  One is for a lockdep warning/lockup (also caught by syzbot), that one
  has been seen in practice. Regarding the other syzbot reports
  mentioned last time, they don't seem to be urgent and reliably
  reproducible so they'll be fixed later.

  The second fix is for a potential corruption when device replace
  finishes and the in-memory state of trim is not copied to the new
  device"

* tag 'for-5.9-rc7-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
  btrfs: fix filesystem corruption after a device replace
  btrfs: move btrfs_rm_dev_replace_free_srcdev outside of all locks
  btrfs: move btrfs_scratch_superblocks into btrfs_dev_replace_finishing
</content>
</entry>
</feed>
