<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/kernfs, branch linux-3.14.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.14.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.14.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2014-06-07T17:28:08Z</updated>
<entry>
<title>kernfs: add back missing error check in kernfs_fop_mmap()</title>
<updated>2014-06-07T17:28:08Z</updated>
<author>
<name>Tejun Heo</name>
</author>
<published>2014-04-20T12:29:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=59516f324f324b6b392b94833da3972e346c5f0c'/>
<id>urn:sha1:59516f324f324b6b392b94833da3972e346c5f0c</id>
<content type='text'>
commit b44b2140265ddfde03acbe809336111d31adb0d1 upstream.

While updating how mmap enabled kernfs files are handled by lockdep,
9b2db6e18945 ("sysfs: bail early from kernfs_file_mmap() to avoid
spurious lockdep warning") inadvertently dropped error return check
from kernfs_file_mmap().  The intention was just dropping "if
(ops-&gt;mmap)" check as the control won't reach the point if the mmap
callback isn't implemented, but I mistakenly removed the error return
check together with it.

This led to Xorg crash on i810 which was reported and bisected to the
commit and then to the specific change by Tobias.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-and-bisected-by: Tobias Powalowski &lt;tobias.powalowski@googlemail.com&gt;
Tested-by: Tobias Powalowski &lt;tobias.powalowski@googlemail.com&gt;
References: http://lkml.kernel.org/g/533D01BD.1010200@googlemail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>kernfs: protect lazy kernfs_iattrs allocation with mutex</title>
<updated>2014-04-27T00:19:04Z</updated>
<author>
<name>Tejun Heo</name>
</author>
<published>2014-04-02T20:40:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=29b311867df2f1f7aee9ec42517becbbb4aeeeef'/>
<id>urn:sha1:29b311867df2f1f7aee9ec42517becbbb4aeeeef</id>
<content type='text'>
commit 4afddd60a770560d370d6f85c5aef57c16bf7502 upstream.

kernfs_iattrs is allocated lazily when operations which require it
take place; unfortunately, the lazy allocation and returning weren't
properly synchronized and when there are multiple concurrent
operations, it might end up returning kernfs_iattrs which hasn't
finished initialization yet or different copies to different callers.

Fix it by synchronizing with a mutex.  This can be smarter with memory
barriers but let's go there if it actually turns out to be necessary.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Link: http://lkml.kernel.org/g/533ABA32.9080602@oracle.com
Reported-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>kernfs: fix off by one error.</title>
<updated>2014-04-27T00:19:03Z</updated>
<author>
<name>Richard Cochran</name>
</author>
<published>2014-03-05T16:10:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=52d6c48c9db5b020e6595067a7f1b00562d26434'/>
<id>urn:sha1:52d6c48c9db5b020e6595067a7f1b00562d26434</id>
<content type='text'>
commit 88391d49abb7d8dee91d405f96bd9e003cb6798d upstream.

The hash values 0 and 1 are reserved for magic directory entries, but
the code only prevents names hashing to 0. This patch fixes the test
to also prevent hash value 1.

Signed-off-by: Richard Cochran &lt;richardcochran@gmail.com&gt;
Reviewed-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>sysfs: fix namespace refcnt leak</title>
<updated>2014-02-25T15:37:52Z</updated>
<author>
<name>Li Zefan</name>
</author>
<published>2014-02-25T11:28:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fed95bab8d29b928fcf6225be72d37ded452e8a2'/>
<id>urn:sha1:fed95bab8d29b928fcf6225be72d37ded452e8a2</id>
<content type='text'>
As mount() and kill_sb() is not a one-to-one match, we shoudn't get
ns refcnt unconditionally in sysfs_mount(), and instead we should
get the refcnt only when kernfs_mount() allocated a new superblock.

v2:
- Changed the name of the new argument, suggested by Tejun.
- Made the argument optional, suggested by Tejun.

v3:
- Make the new argument as second-to-last arg, suggested by Tejun.

Signed-off-by: Li Zefan &lt;lizefan@huawei.com&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
 ---
 fs/kernfs/mount.c      | 8 +++++++-
 fs/sysfs/mount.c       | 5 +++--
 include/linux/kernfs.h | 9 +++++----
 3 files changed, 15 insertions(+), 7 deletions(-)
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>kernfs: make kernfs_deactivate() honor KERNFS_LOCKDEP flag</title>
<updated>2014-02-05T19:44:04Z</updated>
<author>
<name>Tejun Heo</name>
</author>
<published>2014-01-29T17:04:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=da9846ae15186d491d6e21ebbb5051e1d3c7f652'/>
<id>urn:sha1:da9846ae15186d491d6e21ebbb5051e1d3c7f652</id>
<content type='text'>
kernfs_deactivate() forgot to check whether KERNFS_LOCKDEP is set
before performing lockdep annotations and ends up feeding
uninitialized lockdep_map to lockdep triggering warning like the
following on USB stick hotunplug.

 usb 1-2: USB disconnect, device number 2
 INFO: trying to register non-static key.
 the code is fine but needs lockdep annotation.
 turning off the locking correctness validator.
 CPU: 1 PID: 62 Comm: khubd Not tainted 3.13.0-work+ #82
 Hardware name: empty empty/S3992, BIOS 080011  10/26/2007
  ffff880065ca7f60 ffff88013a4ffa08 ffffffff81cfb6bd 0000000000000002
  ffff88013a4ffac8 ffffffff810f8530 ffff88013a4fc710 0000000000000002
  ffff880100000000 ffffffff82a3db50 0000000000000001 ffff88013a4fc710
 Call Trace:
  [&lt;ffffffff81cfb6bd&gt;] dump_stack+0x4e/0x7a
  [&lt;ffffffff810f8530&gt;] __lock_acquire+0x1910/0x1e70
  [&lt;ffffffff810f931a&gt;] lock_acquire+0x9a/0x1d0
  [&lt;ffffffff8127c75e&gt;] kernfs_deactivate+0xee/0x130
  [&lt;ffffffff8127d4c8&gt;] kernfs_addrm_finish+0x38/0x60
  [&lt;ffffffff8127d701&gt;] kernfs_remove_by_name_ns+0x51/0xa0
  [&lt;ffffffff8127b4f1&gt;] remove_files.isra.1+0x41/0x80
  [&lt;ffffffff8127b7e7&gt;] sysfs_remove_group+0x47/0xa0
  [&lt;ffffffff8127b873&gt;] sysfs_remove_groups+0x33/0x50
  [&lt;ffffffff8177d66d&gt;] device_remove_attrs+0x4d/0x80
  [&lt;ffffffff8177e25e&gt;] device_del+0x12e/0x1d0
  [&lt;ffffffff819722c2&gt;] usb_disconnect+0x122/0x1a0
  [&lt;ffffffff819749b5&gt;] hub_thread+0x3c5/0x1290
  [&lt;ffffffff810c6a6d&gt;] kthread+0xed/0x110
  [&lt;ffffffff81d0a56c&gt;] ret_from_fork+0x7c/0xb0

Fix it by making kernfs_deactivate() perform lockdep annotations only
if KERNFS_LOCKDEP is set.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: Fabio Estevam &lt;festevam@gmail.com&gt;
Reported-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Reported-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
Reported-by: Dave Jones &lt;davej@redhat.com&gt;
Tested-by: Fabio Estevam &lt;fabio.estevam@freescale.com&gt;
Tested-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>kernfs: associate a new kernfs_node with its parent on creation</title>
<updated>2014-01-17T19:50:07Z</updated>
<author>
<name>Tejun Heo</name>
</author>
<published>2014-01-17T14:58:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=db4aad209bc9aefd91f0a9aeb9e37364088b39ad'/>
<id>urn:sha1:db4aad209bc9aefd91f0a9aeb9e37364088b39ad</id>
<content type='text'>
Once created, a kernfs_node is always destroyed by kernfs_put().
Since ba7443bc656e ("sysfs, kernfs: implement
kernfs_create/destroy_root()"), kernfs_put() depends on kernfs_root()
to locate the ino_ida.  kernfs_root() in turn depends on
kernfs_node-&gt;parent being set for !dir nodes.  This means that
kernfs_put() of a !dir node requires its -&gt;parent to be initialized.

This leads to oops when a newly created !dir node is destroyed without
going through kernfs_add_one() or after failing kernfs_add_one()
before -&gt;parent is set.  kernfs_root() invoked from kernfs_put() will
try to dereference NULL parent.

Fix it by moving parent association to kernfs_new_node() from
kernfs_add_one().  kernfs_new_node() now takes @parent instead of
@root and determines the root from the parent and also sets the new
node's parent properly.  @parent parameter is removed from
kernfs_add_one().  As there's no parent when creating the root node,
__kernfs_new_node() which takes @root as before and doesn't set the
parent is used in that case.

This ensures that a kernfs_node in any stage in its life has its
parent associated and thus can be put.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>kernfs: fix get_active failure handling in kernfs_seq_*()</title>
<updated>2014-01-14T16:49:22Z</updated>
<author>
<name>Tejun Heo</name>
</author>
<published>2014-01-14T14:52:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bb305947bdbb67325e1f949183cdd208fc2a7999'/>
<id>urn:sha1:bb305947bdbb67325e1f949183cdd208fc2a7999</id>
<content type='text'>
When kernfs_seq_start() fails to obtain an active reference, it
returns ERR_PTR(-ENODEV).  kernfs_seq_stop() is then invoked with the
error pointer value; however, it still proceeds to invoke
kernfs_put_active() on the node leading to unbalanced put.

If kernfs_seq_stop() is called even after active ref failure, it
should skip invocation of @ops-&gt;seq_stop() and put_active.
Unfortunately, this is a bit complicated because active ref failure
isn't the only thing which may fail with ERR_PTR(-ENODEV).
@ops-&gt;seq_start/next() may also fail with the error value and
kernfs_seq_stop() doesn't have a way to tell apart those failures.

Work it around by factoring out the active part of kernfs_seq_stop()
into kernfs_seq_stop_active() and invoking it directly if
@ops-&gt;seq_start/next() fail with ERR_PTR(-ENODEV) and updating
kernfs_seq_stop() to skip kernfs_seq_stop_active() on
ERR_PTR(-ENODEV).  This is a bit nasty but ensures that the active put
is skipped iff get_active failed in kernfs_seq_start().

tj: This was originally committed as d92d2e6bd72b but got reverted by
    683bb2761fbf along with other kernfs self removal patches.
    However, this one is an independent fix and shouldn't have been
    reverted together.  Reinstate the change.  Sorry about the mess.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "kernfs: fix get_active failure handling in kernfs_seq_*()"</title>
<updated>2014-01-13T22:49:01Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2014-01-13T22:49:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=683bb2761fbf123b24aed03a1c0d5d7556ec3018'/>
<id>urn:sha1:683bb2761fbf123b24aed03a1c0d5d7556ec3018</id>
<content type='text'>
This reverts commit d92d2e6bd72b653f9811e0c9c46307c743b3fc58.

Tejun writes:
        I'm sorry but can you please revert the whole series?
        get_active() waiting while a node is deactivated has potential
        to lead to deadlock and that deactivate/reactivate interface is
        something fundamentally flawed and that cgroup will have to work
        with the remove_self() like everybody else.  IOW, I think the
        first posting was correct.

Cc: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "kernfs: replace kernfs_node-&gt;u.completion with kernfs_root-&gt;deactivate_waitq"</title>
<updated>2014-01-13T22:43:11Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2014-01-13T22:43:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=87da149343c8c93f6984c0f4b9da7651709624f7'/>
<id>urn:sha1:87da149343c8c93f6984c0f4b9da7651709624f7</id>
<content type='text'>
This reverts commit ea1c472dfeada211a0100daa7976e8e8e779b858.

Tejun writes:
        I'm sorry but can you please revert the whole series?
        get_active() waiting while a node is deactivated has potential
        to lead to deadlock and that deactivate/reactivate interface is
        something fundamentally flawed and that cgroup will have to work
        with the remove_self() like everybody else.  IOW, I think the
        first posting was correct.

Cc: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "kernfs: remove KERNFS_ACTIVE_REF and add kernfs_lockdep()"</title>
<updated>2014-01-13T22:39:52Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2014-01-13T22:39:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0890147fe09ff7e8275a162b1ab76ab5e3158c6d'/>
<id>urn:sha1:0890147fe09ff7e8275a162b1ab76ab5e3158c6d</id>
<content type='text'>
This reverts commit a69d001cfc712b96ec9d7ba44d6285702a38dabf.

Tejun writes:
        I'm sorry but can you please revert the whole series?
        get_active() waiting while a node is deactivated has potential
        to lead to deadlock and that deactivate/reactivate interface is
        something fundamentally flawed and that cgroup will have to work
        with the remove_self() like everybody else.  IOW, I think the
        first posting was correct.

Cc: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
