]> www.infradead.org Git - users/jedix/linux-maple.git/commit
nilfs2: fix NULL pointer in nilfs_##name##_attr_release
authorNanyong Sun <sunnanyong@huawei.com>
Tue, 24 Aug 2021 00:00:01 +0000 (10:00 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 25 Aug 2021 23:34:56 +0000 (09:34 +1000)
commit7a93b66e4b71634d250ef23dea7008c0428aeba6
treec733fdea057b3e61f8bef1d5e0970f3cb58cc6fd
parent09215c5b28591a3ed8823e899e081b164b7fc1fc
nilfs2: fix NULL pointer in nilfs_##name##_attr_release

In nilfs_##name##_attr_release, kobj->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->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 <sunnanyong@huawei.com>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
fs/nilfs2/sysfs.c