<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/ubifs, branch linux-3.16.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.16.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.16.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2020-05-22T20:19:28Z</updated>
<entry>
<title>ubifs: Fix deadlock in concurrent bulk-read and writepage</title>
<updated>2020-05-22T20:19:28Z</updated>
<author>
<name>Zhihao Cheng</name>
</author>
<published>2020-01-11T09:50:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=108dfdd19541cfad81ea3bd8812b4b192a896cc7'/>
<id>urn:sha1:108dfdd19541cfad81ea3bd8812b4b192a896cc7</id>
<content type='text'>
commit f5de5b83303e61b1f3fb09bd77ce3ac2d7a475f2 upstream.

In ubifs, concurrent execution of writepage and bulk read on the same file
may cause ABBA deadlock, for example (Reproduce method see Link):

Process A(Bulk-read starts from page4)         Process B(write page4 back)
  vfs_read                                       wb_workfn or fsync
  ...                                            ...
  generic_file_buffered_read                     write_cache_pages
    ubifs_readpage                                 LOCK(page4)

      ubifs_bulk_read                              ubifs_writepage
        LOCK(ui-&gt;ui_mutex)                           ubifs_write_inode

	  ubifs_do_bulk_read                           LOCK(ui-&gt;ui_mutex)
	    find_or_create_page(alloc page4)                  ↑
	      LOCK(page4)                   &lt;--     ABBA deadlock occurs!

In order to ensure the serialization execution of bulk read, we can't
remove the big lock 'ui-&gt;ui_mutex' in ubifs_bulk_read(). Instead, we
allow ubifs_do_bulk_read() to lock page failed by replacing
find_or_create_page(FGP_LOCK) with
pagecache_get_page(FGP_LOCK | FGP_NOWAIT).

Signed-off-by: Zhihao Cheng &lt;chengzhihao1@huawei.com&gt;
Suggested-by: zhangyi (F) &lt;yi.zhang@huawei.com&gt;
Fixes: 4793e7c5e1c ("UBIFS: add bulk-read facility")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=206153
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
[bwh: Backported to 3.16: Keep using constant GFP flags parameter.]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>ubifs: Check for name being NULL while mounting</title>
<updated>2018-12-16T22:09:24Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2018-09-03T21:06:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e92d32a4f5135040f900a06ecc6cb641bb93e2d9'/>
<id>urn:sha1:e92d32a4f5135040f900a06ecc6cb641bb93e2d9</id>
<content type='text'>
commit 37f31b6ca4311b94d985fb398a72e5399ad57925 upstream.

The requested device name can be NULL or an empty string.
Check for that and refuse to continue. UBIFS has to do this manually
since we cannot use mount_bdev(), which checks for this condition.

Fixes: 1e51764a3c2ac ("UBIFS: add new flash file system")
Reported-by: syzbot+38bd0f7865e5c6379280@syzkaller.appspotmail.com
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>ubifs: Check data node size before truncate</title>
<updated>2018-12-16T22:08:46Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2018-07-01T21:20:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=735bbb86335c08cad3399d9993c8c1091629841b'/>
<id>urn:sha1:735bbb86335c08cad3399d9993c8c1091629841b</id>
<content type='text'>
commit 95a22d2084d72ea067d8323cc85677dba5d97cae upstream.

Check whether the size is within bounds before using it.
If the size is not correct, abort and dump the bad data node.

Cc: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Silvio Cesare &lt;silvio.cesare@gmail.com&gt;
Fixes: 1e51764a3c2ac ("UBIFS: add new flash file system")
Reported-by: Silvio Cesare &lt;silvio.cesare@gmail.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
[bwh: Backported to 3.16: Drop first argument to ubifs_err()]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>ubifs: Fix memory leak in lprobs self-check</title>
<updated>2018-12-16T22:08:46Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2018-06-12T18:49:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0ae67939e008c102cb3612358242817056604de8'/>
<id>urn:sha1:0ae67939e008c102cb3612358242817056604de8</id>
<content type='text'>
commit eef19816ada3abd56d9f20c88794cc2fea83ebb2 upstream.

Allocate the buffer after we return early.
Otherwise memory is being leaked.

Fixes: 1e51764a3c2a ("UBIFS: add new flash file system")
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>ubifs: Fix synced_i_size calculation for xattr inodes</title>
<updated>2018-12-16T22:08:46Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2018-06-11T22:52:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b38e954d9b9b42da01696b042cce29ce7a3d3091'/>
<id>urn:sha1:b38e954d9b9b42da01696b042cce29ce7a3d3091</id>
<content type='text'>
commit 59965593205fa4044850d35ee3557cf0b7edcd14 upstream.

In ubifs_jnl_update() we sync parent and child inodes to the flash,
in case of xattrs, the parent inode (AKA host inode) has a non-zero
data_len. Therefore we need to adjust synced_i_size too.

This issue was reported by ubifs self tests unter a xattr related work
load.
UBIFS error (ubi0:0 pid 1896): dbg_check_synced_i_size: ui_size is 4, synced_i_size is 0, but inode is clean
UBIFS error (ubi0:0 pid 1896): dbg_check_synced_i_size: i_ino 65, i_mode 0x81a4, i_size 4

Fixes: 1e51764a3c2a ("UBIFS: add new flash file system")
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
[bwh: Backported to 3.16: s/host_ui/dir_ui/]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>ubifs: Check ubifs_wbuf_sync() return code</title>
<updated>2018-10-21T07:45:12Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2018-01-17T18:12:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=353a1a581c51b75e83fbff213c42a635772bacd5'/>
<id>urn:sha1:353a1a581c51b75e83fbff213c42a635772bacd5</id>
<content type='text'>
commit aac17948a7ce01fb60b9ee6cf902967a47b3ce26 upstream.

If ubifs_wbuf_sync() fails we must not write a master node with the
dirty marker cleared.
Otherwise it is possible that in case of an IO error while syncing we
mark the filesystem as clean and UBIFS refuses to recover upon next
mount.

Fixes: 1e51764a3c2a ("UBIFS: add new flash file system")
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>mm: drop vm_ops-&gt;remap_pages and generic_file_remap_pages() stub</title>
<updated>2018-10-03T03:09:51Z</updated>
<author>
<name>Kirill A. Shutemov</name>
</author>
<published>2015-02-10T22:09:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ae347f225e91a960c61f7470a3b21bcb4ea5fcfa'/>
<id>urn:sha1:ae347f225e91a960c61f7470a3b21bcb4ea5fcfa</id>
<content type='text'>
commit d83a08db5ba6072caa658745881f4baa9bad6a08 upstream.

Nobody uses it anymore.

[akpm@linux-foundation.org: fix filemap_xip.c]
Signed-off-by: Kirill A. Shutemov &lt;kirill.shutemov@linux.intel.com&gt;
Cc: Wu Fengguang &lt;fengguang.wu@intel.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
[bwh: Backported to 3.16:
 - Deleted code is slightly different
 - Adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>ubifs: Don't leak kernel memory to the MTD</title>
<updated>2017-10-12T14:28:06Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2017-06-16T14:21:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5116caf8fc868e061e074da65947a9ff6f856bff'/>
<id>urn:sha1:5116caf8fc868e061e074da65947a9ff6f856bff</id>
<content type='text'>
commit 4acadda74ff8b949c448c0282765ae747e088c87 upstream.

When UBIFS prepares data structures which will be written to the MTD it
ensues that their lengths are multiple of 8. Since it uses kmalloc() the
padded bytes are left uninitialized and we leak a few bytes of kernel
memory to the MTD.
To make sure that all bytes are initialized, let's switch to kzalloc().
Kzalloc() is fine in this case because the buffers are not huge and in
the IO path the performance bottleneck is anyway the MTD.

Fixes: 1e51764a3c2a ("UBIFS: add new flash file system")
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Reviewed-by: Boris Brezillon &lt;boris.brezillon@free-electrons.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
[bwh: Backported to 3.16:
 - Drop change in ubifs_jnl_xrename()
 - Adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>ubifs: Correctly evict xattr inodes</title>
<updated>2017-10-12T14:28:06Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2017-05-16T22:20:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=112ea4a19a8c3f88ff392cb0f35945ad7151728a'/>
<id>urn:sha1:112ea4a19a8c3f88ff392cb0f35945ad7151728a</id>
<content type='text'>
commit 272eda8298dc82eb411ece82bbb2c62911087b24 upstream.

UBIFS handles extended attributes just like files, as consequence of
that, they also have inodes.
Therefore UBIFS does all the inode machinery also for xattrs. Since new
inodes have i_nlink of 1, a file or xattr inode will be evicted
if i_nlink goes down to 0 after an unlink. UBIFS assumes this model also
for xattrs, which is not correct.
One can create a file "foo" with xattr "user.test". By reading
"user.test" an inode will be created, and by deleting "user.test" it
will get evicted later. The assumption breaks if the file "foo", which
hosts the xattrs, will be removed. VFS nor UBIFS does not remove each
xattr via ubifs_xattr_remove(), it just removes the host inode from
the TNC and all underlying xattr nodes too and the inode will remain
in the cache and wastes memory.

To solve this problem, remove xattr inodes from the VFS inode cache in
ubifs_xattr_remove() to make sure that they get evicted.

Fixes: 1e51764a3c2ac05a ("UBIFS: add new flash file system")
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>ubifs: Fix journal replay wrt. xattr nodes</title>
<updated>2017-03-16T02:27:00Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2017-01-10T10:49:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fcc28a8b7bd1b5253d81a48e23550432f2375288'/>
<id>urn:sha1:fcc28a8b7bd1b5253d81a48e23550432f2375288</id>
<content type='text'>
commit 1cb51a15b576ee325d527726afff40947218fd5e upstream.

When replaying the journal it can happen that a journal entry points to
a garbage collected node.
This is the case when a power-cut occurred between a garbage collect run
and a commit. In such a case nodes have to be read using the failable
read functions to detect whether the found node matches what we expect.

One corner case was forgotten, when the journal contains an entry to
remove an inode all xattrs have to be removed too. UBIFS models xattr
like directory entries, so the TNC code iterates over
all xattrs of the inode and removes them too. This code re-uses the
functions for walking directories and calls ubifs_tnc_next_ent().
ubifs_tnc_next_ent() expects to be used only after the journal and
aborts when a node does not match the expected result. This behavior can
render an UBIFS volume unmountable after a power-cut when xattrs are
used.

Fix this issue by using failable read functions in ubifs_tnc_next_ent()
too when replaying the journal.
Fixes: 1e51764a3c2ac05a ("UBIFS: add new flash file system")
Reported-by: Rock Lee &lt;rockdotlee@gmail.com&gt;
Reviewed-by: David Gstir &lt;david@sigma-star.at&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
</feed>
