<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/nilfs2/sysfs.c, branch linux-6.15.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.15.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.15.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2024-09-02T00:59:00Z</updated>
<entry>
<title>nilfs2: protect references to superblock parameters exposed in sysfs</title>
<updated>2024-09-02T00:59:00Z</updated>
<author>
<name>Ryusuke Konishi</name>
</author>
<published>2024-08-11T10:03:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=683408258917541bdb294cd717c210a04381931e'/>
<id>urn:sha1:683408258917541bdb294cd717c210a04381931e</id>
<content type='text'>
The superblock buffers of nilfs2 can not only be overwritten at runtime
for modifications/repairs, but they are also regularly swapped, replaced
during resizing, and even abandoned when degrading to one side due to
backing device issues.  So, accessing them requires mutual exclusion using
the reader/writer semaphore "nilfs-&gt;ns_sem".

Some sysfs attribute show methods read this superblock buffer without the
necessary mutual exclusion, which can cause problems with pointer
dereferencing and memory access, so fix it.

Link: https://lkml.kernel.org/r/20240811100320.9913-1-konishi.ryusuke@gmail.com
Fixes: da7141fb78db ("nilfs2: add /sys/fs/nilfs2/&lt;device&gt; group")
Signed-off-by: Ryusuke Konishi &lt;konishi.ryusuke@gmail.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>nilfs2: Constify struct kobj_type</title>
<updated>2024-07-12T23:39:52Z</updated>
<author>
<name>Christophe JAILLET</name>
</author>
<published>2024-07-08T14:32:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fbc8846cd9c258e3844d22afd4d1ae7240077aab'/>
<id>urn:sha1:fbc8846cd9c258e3844d22afd4d1ae7240077aab</id>
<content type='text'>
'struct kobj_type' is not modified in this driver. It is only used with
kobject_init_and_add() which takes a "const struct kobj_type *" parameter.

Constifying this structure moves some data to a read-only section, so
increase overall security.

On a x86_64, with allmodconfig:
Before:
======
   text	   data	    bss	    dec	    hex	filename
  22403	   4184	     24	  26611	   67f3	fs/nilfs2/sysfs.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
  22723	   3928	     24	  26675	   6833	fs/nilfs2/sysfs.o

Link: https://lkml.kernel.org/r/20240708143242.3296-1-konishi.ryusuke@gmail.com
Signed-off-by: Christophe JAILLET &lt;christophe.jaillet@wanadoo.fr&gt;
Signed-off-by: Ryusuke Konishi &lt;konishi.ryusuke@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>nilfs2: use default_groups in kobj_type</title>
<updated>2021-12-29T09:53:48Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2021-12-28T14:42:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a6b9a6149d850ab94acc4db9473f124a062be322'/>
<id>urn:sha1:a6b9a6149d850ab94acc4db9473f124a062be322</id>
<content type='text'>
There are currently 2 ways to create a set of sysfs files for a
kobj_type, through the default_attrs field, and the default_groups
field.  Move the nilfs2 code to use default_groups field which has been
the preferred way since aa30f47cf666 ("kobject: Add support for default
attribute groups to kobj_type") so that we can soon get rid of the
obsolete default_attrs field.

Acked-by: Ryusuke Konishi &lt;konishi.ryusuke@gmail.com&gt;
Link: https://lore.kernel.org/r/20211228144252.390554-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>nilfs2: remove filenames from file comments</title>
<updated>2021-11-09T18:02:52Z</updated>
<author>
<name>Ryusuke Konishi</name>
</author>
<published>2021-11-09T02:35:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=94ee1d91514a1e02db87fb09b903b51d86903771'/>
<id>urn:sha1:94ee1d91514a1e02db87fb09b903b51d86903771</id>
<content type='text'>
Remove filenames that are not particularly useful in file comments, and
suppress checkpatch warnings

  WARNING: It's generally not useful to have the filename in the file

Link: https://lkml.kernel.org/r/1635151862-11547-3-git-send-email-konishi.ryusuke@gmail.com
Signed-off-by: Ryusuke Konishi &lt;konishi.ryusuke@gmail.com&gt;
Cc: Qing Wang &lt;wangqing@vivo.com&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>nilfs2: replace snprintf in show functions with sysfs_emit</title>
<updated>2021-11-09T18:02:51Z</updated>
<author>
<name>Qing Wang</name>
</author>
<published>2021-11-09T02:34:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3bcd6c5bd483287f4a09d3d59a012d47677b6edc'/>
<id>urn:sha1:3bcd6c5bd483287f4a09d3d59a012d47677b6edc</id>
<content type='text'>
Patch series "nilfs2 updates".

This patch (of 2):

coccicheck complains about the use of snprintf() in sysfs show functions.

Fix the coccicheck warning:

  WARNING: use scnprintf or sprintf.

Use sysfs_emit instead of scnprintf or sprintf makes more sense.

Link: https://lkml.kernel.org/r/1635151862-11547-1-git-send-email-konishi.ryusuke@gmail.com
Link: https://lkml.kernel.org/r/1634095759-4625-1-git-send-email-wangqing@vivo.com
Link: https://lkml.kernel.org/r/1635151862-11547-2-git-send-email-konishi.ryusuke@gmail.com
Signed-off-by: Qing Wang &lt;wangqing@vivo.com&gt;
Signed-off-by: Ryusuke Konishi &lt;konishi.ryusuke@gmail.com&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>nilfs2: fix memory leak in nilfs_sysfs_delete_snapshot_group</title>
<updated>2021-09-08T18:50:27Z</updated>
<author>
<name>Nanyong Sun</name>
</author>
<published>2021-09-08T03:00:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=17243e1c3072b8417a5ebfc53065d0a87af7ca77'/>
<id>urn:sha1:17243e1c3072b8417a5ebfc53065d0a87af7ca77</id>
<content type='text'>
kobject_put() should be used to cleanup the memory associated with the
kobject instead of kobject_del().  See the section "Kobject removal" of
"Documentation/core-api/kobject.rst".

Link: https://lkml.kernel.org/r/20210629022556.3985106-7-sunnanyong@huawei.com
Link: https://lkml.kernel.org/r/1625651306-10829-7-git-send-email-konishi.ryusuke@gmail.com
Signed-off-by: Nanyong Sun &lt;sunnanyong@huawei.com&gt;
Signed-off-by: Ryusuke Konishi &lt;konishi.ryusuke@gmail.com&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>nilfs2: fix memory leak in nilfs_sysfs_create_snapshot_group</title>
<updated>2021-09-08T18:50:27Z</updated>
<author>
<name>Nanyong Sun</name>
</author>
<published>2021-09-08T03:00:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b2fe39c248f3fa4bbb2a20759b4fdd83504190f7'/>
<id>urn:sha1:b2fe39c248f3fa4bbb2a20759b4fdd83504190f7</id>
<content type='text'>
If kobject_init_and_add returns with error, kobject_put() is needed here
to avoid memory leak, because kobject_init_and_add may return error
without freeing the memory associated with the kobject it allocated.

Link: https://lkml.kernel.org/r/20210629022556.3985106-6-sunnanyong@huawei.com
Link: https://lkml.kernel.org/r/1625651306-10829-6-git-send-email-konishi.ryusuke@gmail.com
Signed-off-by: Nanyong Sun &lt;sunnanyong@huawei.com&gt;
Signed-off-by: Ryusuke Konishi &lt;konishi.ryusuke@gmail.com&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>nilfs2: fix memory leak in nilfs_sysfs_delete_##name##_group</title>
<updated>2021-09-08T18:50:27Z</updated>
<author>
<name>Nanyong Sun</name>
</author>
<published>2021-09-08T03:00:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a3e181259ddd61fd378390977a1e4e2316853afa'/>
<id>urn:sha1:a3e181259ddd61fd378390977a1e4e2316853afa</id>
<content type='text'>
The kobject_put() should be used to cleanup the memory associated with the
kobject instead of kobject_del.  See the section "Kobject removal" of
"Documentation/core-api/kobject.rst".

Link: https://lkml.kernel.org/r/20210629022556.3985106-5-sunnanyong@huawei.com
Link: https://lkml.kernel.org/r/1625651306-10829-5-git-send-email-konishi.ryusuke@gmail.com
Signed-off-by: Nanyong Sun &lt;sunnanyong@huawei.com&gt;
Signed-off-by: Ryusuke Konishi &lt;konishi.ryusuke@gmail.com&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>nilfs2: fix memory leak in nilfs_sysfs_create_##name##_group</title>
<updated>2021-09-08T18:50:27Z</updated>
<author>
<name>Nanyong Sun</name>
</author>
<published>2021-09-08T03:00:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=24f8cb1ed057c840728167dab33b32e44147c86f'/>
<id>urn:sha1:24f8cb1ed057c840728167dab33b32e44147c86f</id>
<content type='text'>
If kobject_init_and_add return with error, kobject_put() is needed here to
avoid memory leak, because kobject_init_and_add may return error without
freeing the memory associated with the kobject it allocated.

Link: https://lkml.kernel.org/r/20210629022556.3985106-4-sunnanyong@huawei.com
Link: https://lkml.kernel.org/r/1625651306-10829-4-git-send-email-konishi.ryusuke@gmail.com
Signed-off-by: Nanyong Sun &lt;sunnanyong@huawei.com&gt;
Signed-off-by: Ryusuke Konishi &lt;konishi.ryusuke@gmail.com&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>nilfs2: fix NULL pointer in nilfs_##name##_attr_release</title>
<updated>2021-09-08T18:50:27Z</updated>
<author>
<name>Nanyong Sun</name>
</author>
<published>2021-09-08T03:00:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=dbc6e7d44a514f231a64d9d5676e001b660b6448'/>
<id>urn:sha1:dbc6e7d44a514f231a64d9d5676e001b660b6448</id>
<content type='text'>
In nilfs_##name##_attr_release, kobj-&gt;parent should not be referenced
because it is a NULL pointer.  The release() method of kobject is always
called in kobject_put(kobj), in the implementation of kobject_put(), the
kobj-&gt;parent will be assigned as NULL before call the release() method.
So just use kobj to get the subgroups, which is more efficient and can fix
a NULL pointer reference problem.

Link: https://lkml.kernel.org/r/20210629022556.3985106-3-sunnanyong@huawei.com
Link: https://lkml.kernel.org/r/1625651306-10829-3-git-send-email-konishi.ryusuke@gmail.com
Signed-off-by: Nanyong Sun &lt;sunnanyong@huawei.com&gt;
Signed-off-by: Ryusuke Konishi &lt;konishi.ryusuke@gmail.com&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>
</feed>
