<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/fs/sysfs, branch v3.2.38</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/fs/sysfs?h=v3.2.38</id>
<link rel='self' href='https://git.amat.us/linux/atom/fs/sysfs?h=v3.2.38'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2012-10-30T23:26:59Z</updated>
<entry>
<title>sysfs: sysfs_pathname/sysfs_add_one: Use strlcat() instead of strcat()</title>
<updated>2012-10-30T23:26:59Z</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=6a026352765b0830d1e6f1fa2a8c1c0499fc1508'/>
<id>urn:sha1:6a026352765b0830d1e6f1fa2a8c1c0499fc1508</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;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>sysfs: Fix memory leak in sysfs_sd_setsecdata().</title>
<updated>2012-04-02T16:52:30Z</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=cbdbd450211dd493262c0573e7143e1bb0bf7892'/>
<id>urn:sha1:cbdbd450211dd493262c0573e7143e1bb0bf7892</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>sysfs: Complain bitterly about attempts to remove files from nonexistent directories.</title>
<updated>2012-02-03T17:21:47Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2012-01-14T05:32:59Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=bfd534c72bec682cbf1017e54f0749aac24840eb'/>
<id>urn:sha1:bfd534c72bec682cbf1017e54f0749aac24840eb</id>
<content type='text'>
commit ce597919361dcec97341151690e780eade2a9cf4 upstream.

Recently an OOPS was observed from the usb serial io_ti driver when it tried to remove
sysfs directories.  Upon investigation it turns out this driver was always buggy
and that a recent sysfs change had stopped guarding itself against removing attributes
from sysfs directories that had already been removed. :(

Historically we have been silent about attempting to files from nonexistent sysfs
directories and have politely returned error codes.  That has resulted in people writing
broken code that ignores the error codes.

Issue a kernel WARNING and a stack backtrace to make it clear in no uncertain
terms that abusing sysfs is not ok, and the callers need to fix their code.

This change transforms the io_ti OOPS into a more comprehensible error message
and stack backtrace.

Signed-off-by: Eric W. Biederman &lt;ebiederm@xmission.com&gt;
Reported-by: Wolfgang Frisch &lt;wfpub@roembden.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>filesystems: add set_nlink()</title>
<updated>2011-11-02T11:53:43Z</updated>
<author>
<name>Miklos Szeredi</name>
<email>mszeredi@suse.cz</email>
</author>
<published>2011-10-28T12:13:29Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=bfe8684869601dacfcb2cd69ef8cfd9045f62170'/>
<id>urn:sha1:bfe8684869601dacfcb2cd69ef8cfd9045f62170</id>
<content type='text'>
Replace remaining direct i_nlink updates with a new set_nlink()
updater function.

Signed-off-by: Miklos Szeredi &lt;mszeredi@suse.cz&gt;
Tested-by: Toshiyuki Okajima &lt;toshi.okajima@jp.fujitsu.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>sysfs: Make sysfs_rename safe with sysfs_dirents in rbtrees.</title>
<updated>2011-11-01T16:16:14Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2011-11-01T14:06:17Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=f6d90b4f9ce018bff429d6e01ee672de712b8641'/>
<id>urn:sha1:f6d90b4f9ce018bff429d6e01ee672de712b8641</id>
<content type='text'>
In sysfs_rename we need to remove the optimization of not calling
sysfs_unlink_sibling and sysfs_link_sibling if the renamed parent
directory is not changing.  This optimization is no longer valid now
that sysfs dirents are stored in an rbtree sorted by name.

Move the assignment of s_ns before the call of sysfs_link_sibling.  With
no sysfs_dirent fields changing after the call of sysfs_link_sibling
this allows sysfs_link_sibling to take any of the directory entries into
account when it builds the rbtrees, and s_ns looks like a prime canidate
to be used in the rbtree in the future.

Signed-off-by: Eric W. Biederman &lt;ebiederm@xmission.com&gt;
Cc: Jiri Slaby &lt;jirislaby@gmail.com&gt;
Cc: Greg KH &lt;gregkh@suse.de&gt;
Cc: David Miller &lt;davem@davemloft.net&gt;
Cc: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>sysfs: Remove support for tagged directories with untagged members (again)</title>
<updated>2011-10-25T13:10:28Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2011-10-25T12:38:41Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=b9e2780d576a010d4aba1e69f247170bf3718d6b'/>
<id>urn:sha1:b9e2780d576a010d4aba1e69f247170bf3718d6b</id>
<content type='text'>
In commit 8a9ea3237e7e ("Merge git://.../davem/net-next") where my sysfs
changes from the net tree merged with the sysfs rbtree changes from
Mickulas Patocka the conflict resolution failed to preserve the
simplified property that was the point of my changes.

That is sysfs_find_dirent can now say something is a match if and only
s_name and s_ns match what we are looking for, and sysfs_readdir can
simply return all of the directory entries where s_ns matches the
directory that we should be returning.

Now that we are back to exact matches we can tweak sysfs_find_dirent and
the name rb_tree to order sysfs_dirents by s_ns s_name and remove the
second loop in sysfs_find_dirent.  However that change seems a bit much
for a conflict resolution so it can come later.

Signed-off-by: Eric W. Biederman &lt;ebiederm@xmission.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next</title>
<updated>2011-10-25T11:25:22Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2011-10-25T11:25:22Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=8a9ea3237e7eb5c25f09e429ad242ae5a3d5ea22'/>
<id>urn:sha1:8a9ea3237e7eb5c25f09e429ad242ae5a3d5ea22</id>
<content type='text'>
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1745 commits)
  dp83640: free packet queues on remove
  dp83640: use proper function to free transmit time stamping packets
  ipv6: Do not use routes from locally generated RAs
  |PATCH net-next] tg3: add tx_dropped counter
  be2net: don't create multiple RX/TX rings in multi channel mode
  be2net: don't create multiple TXQs in BE2
  be2net: refactor VF setup/teardown code into be_vf_setup/clear()
  be2net: add vlan/rx-mode/flow-control config to be_setup()
  net_sched: cls_flow: use skb_header_pointer()
  ipv4: avoid useless call of the function check_peer_pmtu
  TCP: remove TCP_DEBUG
  net: Fix driver name for mdio-gpio.c
  ipv4: tcp: fix TOS value in ACK messages sent from TIME_WAIT
  rtnetlink: Add missing manual netlink notification in dev_change_net_namespaces
  ipv4: fix ipsec forward performance regression
  jme: fix irq storm after suspend/resume
  route: fix ICMP redirect validation
  net: hold sock reference while processing tx timestamps
  tcp: md5: add more const attributes
  Add ethtool -g support to virtio_net
  ...

Fix up conflicts in:
 - drivers/net/Kconfig:
	The split-up generated a trivial conflict with removal of a
	stale reference to Documentation/networking/net-modules.txt.
	Remove it from the new location instead.
 - fs/sysfs/dir.c:
	Fairly nasty conflicts with the sysfs rb-tree usage, conflicting
	with Eric Biederman's changes for tagged directories.
</content>
</entry>
<entry>
<title>sysfs: Reject with a warning invalid uses of tagged directories.</title>
<updated>2011-10-19T23:24:16Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2011-10-12T22:02:43Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=903e21e2eea036f6947f523f732e28b33a63ed0f'/>
<id>urn:sha1:903e21e2eea036f6947f523f732e28b33a63ed0f</id>
<content type='text'>
sysfs is a core piece of ifrastructure that many people use and
few people have all of the rules in their head on how to use
it correctly.  Add warnings for people using tagged directories
improperly to that any misuses can be caught and diagnosed quickly.

A single inexpensive test in sysfs_find_dirent is almost sufficient
to catch all possible misuses.  An additional warning is needed
in sysfs_add_dirent so that we actually fail when attempting to
add an untagged dirent in a tagged directory.

Signed-off-by: Eric W. Biederman &lt;ebiederm@xmission.com&gt;
Acked-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sysfs: Remove support for tagged directories with untagged members.</title>
<updated>2011-10-19T23:24:15Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2011-10-12T22:01:34Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=23396180a9770df2c6a694bbb689c12bdf792f94'/>
<id>urn:sha1:23396180a9770df2c6a694bbb689c12bdf792f94</id>
<content type='text'>
Now that /sys/class/net/bonding_masters is implemented as a tagged sysfs
file we can remove support for untagged files in tagged directories.

This change removes any ambiguity of what a NULL namespace value
means.  A NULL namespace parameter after this patch means
that we are talking about an untagged sysfs dirent.

This makes the sysfs code much less prone to mistakes when during
maintenance.

Signed-off-by: Eric W. Biederman &lt;ebiederm@xmission.com&gt;
Acked-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>sysfs: Implement support for tagged files in sysfs.</title>
<updated>2011-10-19T23:24:14Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2011-10-12T21:53:38Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=487505c257021fc06a7d05753cf27b011487f1dc'/>
<id>urn:sha1:487505c257021fc06a7d05753cf27b011487f1dc</id>
<content type='text'>
Looking up files in sysfs is hard to understand and analyize because we
currently allow placing untagged files in tagged directories.  In the
implementation of that we have two subtly different meanings of NULL.
NULL meaning there is no tag on a directory entry and NULL meaning
we don't care which namespace the lookup is performed for.  This
multiple uses of NULL have resulted in subtle bugs (since fixed)
in the code.

Currently it is only the bonding driver that needs to have an untagged
file in a tagged directory.

To untagle this mess I am adding support for tagged files to sysfs.
Modifying the bonding driver to implement bonding_masters as a tagged
file.  Registering bonding_masters once for each network namespace.
Then I am removing support for untagged entries in tagged sysfs
directories.

Resulting in code that is much easier to reason about.

Signed-off-by: Eric W. Biederman &lt;ebiederm@xmission.com&gt;
Acked-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
