]> git.proxmox.com Git - mirror_zfs.git/commit
Fix small sysfs leak
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 26 Sep 2018 16:50:58 +0000 (09:50 -0700)
committerGitHub <noreply@github.com>
Wed, 26 Sep 2018 16:50:58 +0000 (09:50 -0700)
commit7a23c81342df05ace730bd303b4a73854dba43dd
tree39569e47af4b369c9813aca12dd8ff72a3a1e481
parentb954e36e512171d94637c709023e4d763b655d91
Fix small sysfs leak

When zfs_kobj_init() is called with an attr_cnt of 0 only the
kobj->zko_default_attrs is allocated.  It subsequently won't
get freed in zfs_kobj_release since the free is wrapped in
a kobj->zko_attr_count != 0 conditional.

Split the block in zfs_kobj_release() to make sure the
kobj->zko_default_attrs are freed in this case.

Additionally, fix a minor spelling mistake and typo in
zfs_kobj_init() which could also cause a leak but in practice
is almost certain not to fail.

Reviewed-by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed-by: Tim Chase <tim@chase2k.com>
Reviewed-by: John Gallagher <john.gallagher@delphix.com>
Reviewed-by: Don Brady <don.brady@delphix.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #7957
module/zfs/zfs_sysfs.c