<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/fs/sysfs, branch v3.0.84</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/fs/sysfs?h=v3.0.84</id>
<link rel='self' href='https://git.amat.us/linux/atom/fs/sysfs?h=v3.0.84'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2013-04-26T04:23:48Z</updated>
<entry>
<title>Revert "sysfs: fix race between readdir and lseek"</title>
<updated>2013-04-26T04:23:48Z</updated>
<author>
<name>Jiri Kosina</name>
<email>jkosina@suse.cz</email>
</author>
<published>2013-04-22T13:40:15Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=bb5489176fda28aff304b59e0405f7d7d4906224'/>
<id>urn:sha1:bb5489176fda28aff304b59e0405f7d7d4906224</id>
<content type='text'>
This reverts commit 991f76f837bf22c5bb07261cfd86525a0a96650c in Linus'
tree which is f366c8f271888f48e15cc7c0ab70f184c220c8a4 in
linux-stable.git

It depends on ef3d0fd27e90f ("vfs: do (nearly) lockless generic_file_llseek")
which is available only in 3.2+.

When applied on 3.0 codebase, it causes A-A deadlock, whenever anyone does
seek() on sysfs, as both generic_file_llseek() and sysfs_dir_llseek() obtain
i_mutex.

Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
Cc: Jiri Slaby &lt;jslaby@suse.cz&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>sysfs: handle failure path correctly for readdir()</title>
<updated>2013-04-05T17:16:36Z</updated>
<author>
<name>Ming Lei</name>
<email>ming.lei@canonical.com</email>
</author>
<published>2013-03-20T15:25:25Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=b76c1eabd474cd44937fc60a26be2b926a366e55'/>
<id>urn:sha1:b76c1eabd474cd44937fc60a26be2b926a366e55</id>
<content type='text'>
commit e5110f411d2ee35bf8d202ccca2e89c633060dca upstream.

In case of 'if (filp-&gt;f_pos ==  0 or 1)' of sysfs_readdir(),
the failure from filldir() isn't handled, and the reference counter
of the sysfs_dirent object pointed by filp-&gt;private_data will be
released without clearing filp-&gt;private_data, so use after free
bug will be triggered later.

This patch returns immeadiately under the situation for fixing the bug,
and it is reasonable to return from readdir() when filldir() fails.

Reported-by: Dave Jones &lt;davej@redhat.com&gt;
Tested-by: Sasha Levin &lt;levinsasha928@gmail.com&gt;
Signed-off-by: Ming Lei &lt;ming.lei@canonical.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>sysfs: fix race between readdir and lseek</title>
<updated>2013-04-05T17:16:36Z</updated>
<author>
<name>Ming Lei</name>
<email>ming.lei@canonical.com</email>
</author>
<published>2013-03-20T15:25:24Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=f366c8f271888f48e15cc7c0ab70f184c220c8a4'/>
<id>urn:sha1:f366c8f271888f48e15cc7c0ab70f184c220c8a4</id>
<content type='text'>
commit 991f76f837bf22c5bb07261cfd86525a0a96650c upstream.

While readdir() is running, lseek() may set filp-&gt;f_pos as zero,
then may leave filp-&gt;private_data pointing to one sysfs_dirent
object without holding its reference counter, so the sysfs_dirent
object may be used after free in next readdir().

This patch holds inode-&gt;i_mutex to avoid the problem since
the lock is always held in readdir path.

Reported-by: Dave Jones &lt;davej@redhat.com&gt;
Tested-by: Sasha Levin &lt;levinsasha928@gmail.com&gt;
Signed-off-by: Ming Lei &lt;ming.lei@canonical.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>sysfs: sysfs_pathname/sysfs_add_one: Use strlcat() instead of strcat()</title>
<updated>2012-10-31T16:51:35Z</updated>
<author>
<name>Geert Uytterhoeven</name>
<email>geert@linux-m68k.org</email>
</author>
<published>2012-09-29T20:23:19Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=e17ce2ec38fd766e8f9707701e47f4332d8bb630'/>
<id>urn:sha1:e17ce2ec38fd766e8f9707701e47f4332d8bb630</id>
<content type='text'>
commit 66081a72517a131430dcf986775f3268aafcb546 upstream.

The warning check for duplicate sysfs entries can cause a buffer overflow
when printing the warning, as strcat() doesn't check buffer sizes.
Use strlcat() instead.

Since strlcat() doesn't return a pointer to the passed buffer, unlike
strcat(), I had to convert the nested concatenation in sysfs_add_one() to
an admittedly more obscure comma operator construct, to avoid emitting code
for the concatenation if CONFIG_BUG is disabled.

Signed-off-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>sysfs: Fix memory leak in sysfs_sd_setsecdata().</title>
<updated>2012-04-02T16:26:53Z</updated>
<author>
<name>Masami Ichikawa</name>
<email>masami256@gmail.com</email>
</author>
<published>2012-02-20T22:43:50Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ac51a34e78db88ef4392040097f82ce3cc28b666'/>
<id>urn:sha1:ac51a34e78db88ef4392040097f82ce3cc28b666</id>
<content type='text'>
commit 93518dd2ebafcc761a8637b2877008cfd748c202 upstream.

This patch fixies follwing two memory leak patterns that reported by kmemleak.
sysfs_sd_setsecdata() is called during sys_lsetxattr() operation.
It checks sd-&gt;s_iattr is NULL or not. Then if it is NULL, it calls
sysfs_init_inode_attrs() to allocate memory.
That code is this.

iattrs = sd-&gt;s_iattr;
if (!iattrs)
                iattrs = sysfs_init_inode_attrs(sd);

The iattrs recieves sysfs_init_inode_attrs()'s result,  but sd-&gt;s_iattr
doesn't know the address. so it needs to set correct address to
sd-&gt;s_iattr to free memory in other function.

unreferenced object 0xffff880250b73e60 (size 32):
  comm "systemd", pid 1, jiffies 4294683888 (age 94.553s)
  hex dump (first 32 bytes):
    73 79 73 74 65 6d 5f 75 3a 6f 62 6a 65 63 74 5f  system_u:object_
    72 3a 73 79 73 66 73 5f 74 3a 73 30 00 00 00 00  r:sysfs_t:s0....
  backtrace:
    [&lt;ffffffff814cb1d0&gt;] kmemleak_alloc+0x73/0x98
    [&lt;ffffffff811270ab&gt;] __kmalloc+0x100/0x12c
    [&lt;ffffffff8120775a&gt;] context_struct_to_string+0x106/0x210
    [&lt;ffffffff81207cc1&gt;] security_sid_to_context_core+0x10b/0x129
    [&lt;ffffffff812090ef&gt;] security_sid_to_context+0x10/0x12
    [&lt;ffffffff811fb0da&gt;] selinux_inode_getsecurity+0x7d/0xa8
    [&lt;ffffffff811fb127&gt;] selinux_inode_getsecctx+0x22/0x2e
    [&lt;ffffffff811f4d62&gt;] security_inode_getsecctx+0x16/0x18
    [&lt;ffffffff81191dad&gt;] sysfs_setxattr+0x96/0x117
    [&lt;ffffffff811542f0&gt;] __vfs_setxattr_noperm+0x73/0xd9
    [&lt;ffffffff811543d9&gt;] vfs_setxattr+0x83/0xa1
    [&lt;ffffffff811544c6&gt;] setxattr+0xcf/0x101
    [&lt;ffffffff81154745&gt;] sys_lsetxattr+0x6a/0x8f
    [&lt;ffffffff814efda9&gt;] system_call_fastpath+0x16/0x1b
    [&lt;ffffffffffffffff&gt;] 0xffffffffffffffff
unreferenced object 0xffff88024163c5a0 (size 96):
  comm "systemd", pid 1, jiffies 4294683888 (age 94.553s)
  hex dump (first 32 bytes):
    00 00 00 00 ed 41 00 00 00 00 00 00 00 00 00 00  .....A..........
    00 00 00 00 00 00 00 00 0c 64 42 4f 00 00 00 00  .........dBO....
  backtrace:
    [&lt;ffffffff814cb1d0&gt;] kmemleak_alloc+0x73/0x98
    [&lt;ffffffff81127402&gt;] kmem_cache_alloc_trace+0xc4/0xee
    [&lt;ffffffff81191cbe&gt;] sysfs_init_inode_attrs+0x2a/0x83
    [&lt;ffffffff81191dd6&gt;] sysfs_setxattr+0xbf/0x117
    [&lt;ffffffff811542f0&gt;] __vfs_setxattr_noperm+0x73/0xd9
    [&lt;ffffffff811543d9&gt;] vfs_setxattr+0x83/0xa1
    [&lt;ffffffff811544c6&gt;] setxattr+0xcf/0x101
    [&lt;ffffffff81154745&gt;] sys_lsetxattr+0x6a/0x8f
    [&lt;ffffffff814efda9&gt;] system_call_fastpath+0x16/0x1b
    [&lt;ffffffffffffffff&gt;] 0xffffffffffffffff
`

Signed-off-by: Masami Ichikawa &lt;masami256@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>Delay struct net freeing while there's a sysfs instance refering to it</title>
<updated>2011-06-12T21:45:41Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2011-06-09T01:13:01Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=a685e08987d1edf1995b76511d4c98ea0e905377'/>
<id>urn:sha1:a685e08987d1edf1995b76511d4c98ea0e905377</id>
<content type='text'>
	* new refcount in struct net, controlling actual freeing of the memory
	* new method in kobj_ns_type_operations (-&gt;drop_ns())
	* -&gt;current_ns() semantics change - it's supposed to be followed by
corresponding -&gt;drop_ns().  For struct net in case of CONFIG_NET_NS it bumps
the new refcount; net_drop_ns() decrements it and calls net_free() if the
last reference has been dropped.  Method renamed to -&gt;grab_current_ns().
	* old net_free() callers call net_drop_ns() instead.
	* sysfs_exit_ns() is gone, along with a large part of callchain
leading to it; now that the references stored in -&gt;ns[...] stay valid we
do not need to hunt them down and replace them with NULL.  That fixes
problems in sysfs_lookup() and sysfs_readdir(), along with getting rid
of sb-&gt;s_instances abuse.

	Note that struct net *shutdown* logics has not changed - net_cleanup()
is called exactly when it used to be called.  The only thing postponed by
having a sysfs instance refering to that struct net is actual freeing of
memory occupied by struct net.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>sysfs: remove "last sysfs file:" line from the oops messages</title>
<updated>2011-05-13T23:05:51Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@suse.de</email>
</author>
<published>2011-05-12T23:01:02Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=82a3242e11d9e63c8195be46c954efaefee35e22'/>
<id>urn:sha1:82a3242e11d9e63c8195be46c954efaefee35e22</id>
<content type='text'>
On some arches (x86, sh, arm, unicore, powerpc) the oops message would
print out the last sysfs file accessed.

This was very useful in finding a number of sysfs and driver core bugs
in the 2.5 and early 2.6 development days, but it has been a number of
years since this file has actually helped in debugging anything that
couldn't also be trivially determined from the stack traceback.

So it's time to delete the line.  This is good as we need all the space
we can get for oops messages at times on consoles.

Acked-by: Phil Carmody &lt;ext-phil.2.carmody@nokia.com&gt;
Acked-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>SYSFS: Fix erroneous comments for sysfs_update_group().</title>
<updated>2011-05-10T21:22:00Z</updated>
<author>
<name>Robert P. J. Day</name>
<email>rpjday@crashcourse.ca</email>
</author>
<published>2011-05-07T21:18:20Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=1f8e1cdac616e510eeb2dc2a9226bf597bc6cfd6'/>
<id>urn:sha1:1f8e1cdac616e510eeb2dc2a9226bf597bc6cfd6</id>
<content type='text'>
Fix what is clearly a simple copy-and-paste error in commenting the
sysfs_update_group() routine.

Signed-off-by: Robert P. J. Day &lt;rpjday@crashcourse.ca&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT</title>
<updated>2011-01-21T01:02:05Z</updated>
<author>
<name>David Rientjes</name>
<email>rientjes@google.com</email>
</author>
<published>2011-01-20T22:44:16Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=6a108a14fa356ef607be308b68337939e56ea94e'/>
<id>urn:sha1:6a108a14fa356ef607be308b68337939e56ea94e</id>
<content type='text'>
The meaning of CONFIG_EMBEDDED has long since been obsoleted; the option
is used to configure any non-standard kernel with a much larger scope than
only small devices.

This patch renames the option to CONFIG_EXPERT in init/Kconfig and fixes
references to the option throughout the kernel.  A new CONFIG_EMBEDDED
option is added that automatically selects CONFIG_EXPERT when enabled and
can be used in the future to isolate options that should only be
considered for embedded systems (RISC architectures, SLOB, etc).

Calling the option "EXPERT" more accurately represents its intention: only
expert users who understand the impact of the configuration changes they
are making should enable it.

Reviewed-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Acked-by: David Woodhouse &lt;david.woodhouse@intel.com&gt;
Signed-off-by: David Rientjes &lt;rientjes@google.com&gt;
Cc: Greg KH &lt;gregkh@suse.de&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Robin Holt &lt;holt@sgi.com&gt;
Cc: &lt;linux-arch@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6</title>
<updated>2011-01-11T00:10:33Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2011-01-11T00:10:33Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=e54be894eae10eca9892e965cc9532f5d5a11767'/>
<id>urn:sha1:e54be894eae10eca9892e965cc9532f5d5a11767</id>
<content type='text'>
* 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6:
  driver core: Document that device_rename() is only for networking
  sysfs: remove useless test from sysfs_merge_group
  driver-core: merge private parts of class and bus
  driver core: fix whitespace in class_attr_string
</content>
</entry>
</feed>
